Cache::FastMmap::Tie - Using Cache::FastMmap as hash
use Cache::FastMmap::Tie; my $fc = tie my %hash, 'Cache::FastMmap::Tie', ( share_file => "file_name", cache_size => "1k", expire_time=> "10m", ); $hash{ABC} = 'abc'; # $fc->set('ABC', 'abc'); $hash{abc_def} = [qw(ABC DEF)]; $hash{xyz_XYZ} = {aaa=>'AAA',BBB=>[qw(ccc DDD),{eee=>'FFF'}],xxx=>'YYY'}; print $hash{ABC}; # $fc->get('ABC'); for ( keys %hash ) { # $fc->get_keys(0); print $hash{$_}, "\n"; # $fc->get($_); }
or Basic global parameter can also be obtained from a YAML file.
my $cf = tie my %hash, 'Cache::FastMmap::Tie', {yaml_file=>'yaml.txt'}
It is the sample of the YAML file. (yaml.txt)
expire_time: 1m cache_size: 10k
Tie for Cache::FastMmap. Read `perldoc perltie`
Yuji Suzuki <yuji.suzuki.perl@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Cache::FastMmap
To install Cache::FastMmap::Tie, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cache::FastMmap::Tie
CPAN shell
perl -MCPAN -e shell install Cache::FastMmap::Tie
For more information on module installation, please visit the detailed CPAN module installation guide.