Method::Cached::Manager - Storage for cache used in Method::Cached is managed
In beginning logic or the start-up script:
use Method::Cached::Manager; Method::Cached::Manager->default_domain({ class => 'Cache::FastMmap', }); Method::Cached::Manager->set_domain( 'some-namespace' => { class => 'Cache::Memcached::Fast', args => [ { # Parameter of constructor of class that uses it for cashe servers => [ '192.168.254.2:11211', '192.168.254.3:11211' ], ... }, ], }, ); or use Method::Cached::Manager -default => { class => 'Cache::FastMmap' }, -domains => { 'some-namespace' => { class => 'Cache::Memcached::Fast', args => [ ... ] }, }, ;
Storage for cache used in Method::Cached is managed.
Cache used by default when not specifying it and cache that can be used by specifying the domain can be defined.
This setting is shared on memory management in perl.
When it is defined in the package as follows:
package Foo::Bar; use Method::Cached; sub foo_bar :Cached(60 * 30, [HASH]) { ... }
This method is used as follows:
Foo::Bar::foo_bar(args1 => 1, args2 => 2);
To erase a cache of this method:
Method::Cached::Manager->delete( 'Foo::Bar::foo_bar', # fqn (args1 => 1, args2 => 2), # hash-args );
Satoshi Ohkubo <s.ohkubo@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Method::Cached, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Method::Cached
CPAN shell
perl -MCPAN -e shell install Method::Cached
For more information on module installation, please visit the detailed CPAN module installation guide.