NAME

Cache::Memcached::Indexable::Logic::DigestSHA1 - a fine logic for Cache::Memcached::Indexable

SYNOPSIS

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,
});

DESCRIPTION

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.

METHOD

$logic->set_max_power($power)

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 ...).

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.

AUTHOR

Koichi Taniguchi <taniguchi@livedoor.jp>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Cache::Memcache::Indexable, Cache::Memcached::Indexable::Logic