Cache::SizeAwareMemoryCache -- extends Cache::MemoryCache
| πΌ Use Case | β‘ Command | π Description |
|---|---|---|
| Create a sizeβlimited cache | new Cache::SizeAwareMemoryCache( { max_size => 10000 } ) | Initialise a memory cache that automatically limits its size to 10β―000 bytes |
| Limit cache size at runtime | $cache->limit_size( $size ) | Dynamically adjust the maximum cache size (in bytes) |
| Fullβfeatured initialisation | new Cache::SizeAwareMemoryCache( { namespace => 'ns', default_expires_in => 600, max_size => 10000 } ) | Create a cache with namespace, default expiry and size limit |
The Cache::SizeAwareMemoryCache class adds the ability to dynamically limit the size (in bytes) of a memory based cache. This class also implements the SizeAwareCache interface, providing the 'max_size' option and the 'limit_size( $size )' method.
use Cache::SizeAwareMemoryCache;
my $cache =
new Cache::SizeAwareMemoryCache( { 'namespace' => 'MyNamespace',
'default_expires_in' => 600,
'max_size' => 10000 } );
See Cache::Cache and Cache::SizeAwareCache for the API documentation.
See Cache::Cache and Cache::SizeAwareCache for the standard options.
See Cache::Cache and Cache::SizeAwareCache for the default properties.
Cache::Cache, Cache::SizeAwareCache, Cache::MemoryCache
Original author: DeWitt Clinton <dewitt AT unto.net>
Last author: $Author: dclinton $
Copyright (C) 2001-2003 DeWitt Clinton
Generated by phpman v4.9.22-1-g1b0fcb4 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-05 16:46 @216.73.216.52
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