Cache::SharedMemoryCache — extends the MemoryCache.
| Use Case | Command | Description |
|---|---|---|
| Create shared memory cache | my $c = Cache::SharedMemoryCache->new({ namespace => 'MyNS', default_expires_in => 600 }); | Instantiate with namespace and default expiration |
| Store data | $c->set($key, $value); | Store a value under a key |
| Retrieve data | my $value = $c->get($key); | Get the value for a key |
| Remove data | $c->remove($key); | Remove an entry |
| Clear entire cache | $c->clear(); | Remove all entries |
The SharedMemoryCache extends the MemoryCache class and binds the data store to shared memory so that separate processes can use the same cache.
The official recommendation is now to use FileCache instead of SharedMemoryCache. The reasons for this include:
use Cache::SharedMemoryCache;
my %cache_options_= ( 'namespace' => 'MyNamespace',
'default_expires_in' => 600 );
my $shared_memory_cache =
new Cache::SharedMemoryCache( \%cache_options ) or
croak( "Couldn't instantiate SharedMemoryCache" );
See Cache::Cache for the API documentation.
See Cache::Cache for the standard options.
See Cache::Cache for the default properties.
Original author: DeWitt Clinton <dewitt AT unto.net>
Last author: $Author: dclinton $
Copyright (C) 2001-2003 DeWitt Clinton
Generated by phpman v4.9.25-3-gdbaf087 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-06 19:37 @216.73.217.93
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-pro / taotoken.net / www.chedong.com - original format