Cache-Cache
view release on metacpan or search on metacpan
lib/Cache/SharedMemoryBackend.pm view on Meta::CPAN
);
my $share = new IPC::ShareLite( %ipc_options ) or
throw Error::Simple( "Couldn't instantiate IPC::ShareLite: $!" );
return $share;
}
# this method uses the shared created by Instantiate_Share to
# transparently retrieve a reference to a shared hash structure
sub _Restore_Shared_Hash_Ref
{
my ( $p_ipc_identifier ) = Static_Params( @_ );
Assert_Defined( $p_ipc_identifier );
my $frozen_hash_ref = _Instantiate_Share( $p_ipc_identifier )->fetch( ) or
return { };
return Thaw_Data( $frozen_hash_ref );
}
# this method uses the shared created by Instantiate_Share to
# transparently retrieve a reference to a shared hash structure, and
# additionally exclusively locks the share
sub _Restore_Shared_Hash_Ref_With_Lock
{
my ( $p_ipc_identifier ) = Static_Params( @_ );
Assert_Defined( $p_ipc_identifier );
my $share = _Instantiate_Share( $p_ipc_identifier );
$share->lock( LOCK_EX );
my $frozen_hash_ref = $share->fetch( ) or
return { };
return Thaw_Data( $frozen_hash_ref );
}
# this method uses the shared created by Instantiate_Share to
# transparently persist a reference to a shared hash structure
sub _Store_Shared_Hash_Ref
{
my ( $p_ipc_identifier, $p_hash_ref ) = @_;
Assert_Defined( $p_ipc_identifier );
Assert_Defined( $p_hash_ref );
_Instantiate_Share( $p_ipc_identifier )->store( Freeze_Data( $p_hash_ref ) );
}
# this method uses the shared created by Instantiate_Share to
# transparently persist a reference to a shared hash structure and
# additionally unlocks the share
sub _Store_Shared_Hash_Ref_And_Unlock
{
my ( $p_ipc_identifier, $p_hash_ref ) = @_;
Assert_Defined( $p_ipc_identifier );
Assert_Defined( $p_hash_ref );
my $share = _Instantiate_Share( $p_ipc_identifier );
( run in 0.439 second using v1.01-cache-2.11-cpan-0a6323c29d9 )