Cache::Memcached::Indexable::Logic::DigestSHA1 - a fine logic for Cache::Memcached::Indexable
use Cache::Memcached::Indexable::Logic::DigestSHA1; use Cache::Memcached::Indexable; my $logic = Cache::Memcached::Indexable::Logic::DigestSHA1->new; $logic->set_max_power(0xff); my $memd = Cache::Memcached::Indexable->new({ 'servers' => [ "10.0.0.15:11211", "10.0.0.15:11212", "10.0.0.17:11211", [ "10.0.0.17:11211", 3 ] ], 'debug' => 0, 'compress_threshold' => 10_000, }); $memd->set_logic($logic);
or
my $memd = Cache::Memcache::Indexable->new({ 'logic' => 'Cache::Memcached::Indexable::Logic::DigestSHA1', 'logic_args' => { set_max_power => 0xff }, 'servers' => [ "10.0.0.15:11211", "10.0.0.15:11212", "10.0.0.17:11211", [ "10.0.0.17:11211", 3 ] ], 'debug' => 0, 'compress_threshold' => 10_000, });
This module is a kind of logic class for Cache::Memcached::Indexable. It uses to get an original key through Digest::SHA1::sha1_hex() function with your key.
Digest::SHA1::sha1_hex()
You can set how many patterns do you want to use for the original key. The $power must be a 16's power minus 1 (0xF, 0xFF, 0xFFF, 0xFFFF, 0xFFFFF ...).
$power
Note that the $memd-keys()> will be taken too long time to return all your keys if you set a huge number to this method.
$memd-
Koichi Taniguchi <taniguchi@livedoor.jp>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Cache::Memcache::Indexable, Cache::Memcached::Indexable::Logic
To install Cache::Memcached::Indexable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cache::Memcached::Indexable
CPAN shell
perl -MCPAN -e shell install Cache::Memcached::Indexable
For more information on module installation, please visit the detailed CPAN module installation guide.