Cache::FastMemoryCache - In-memory cache of arbitrary data.
use Cache::FastMemoryCache; my $cache = new Cache::FastMemoryCache({ 'namespace' => 'MyNamespace' }); $key = 'xxx'; $href->{'name'} = 'old name'; $cache->set( $key, $href ); # insert into cache. $href->{'name'} = 'new name'; # modify it after insert. # Later... $href = $cache->get($key); print $href->{'name'}; # prints "new name"
Cache::FastMemoryCache is an in-memory cache, implemented as an extension to the excellent Cache::Cache suite. All cached items are stored per-process. The cache does not persist after the process dies. It is the fastest of all the Cache::* types because it does not perform deep copying of data.
See Cache::Cache for the API.
The other Cache::* types make deep copies of data before inserting it into the cache -- FastMemoryCache does not make copies.
The example in the SYNOPSIS section of this manual prints "new name" with FastMemoryCache, but prints "old name" with other cache types!
John Millaway <millaway@acm.org>
(Based heavily on DeWitt Clinton's Cache::MemoryCache module.)
Cache::Cache, Cache::MemoryCache.
To install Cache::FastMemoryCache, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cache::FastMemoryCache
CPAN shell
perl -MCPAN -e shell install Cache::FastMemoryCache
For more information on module installation, please visit the detailed CPAN module installation guide.