Mojo::Cache
НАЗВАНИЕ
Mojo::Cache - Naive In-Memory Cache
КРАТКИЙ ОБЗОР
use Mojo::Cache; my $cache = Mojo::Cache->new(max_keys => 50); $cache->set(foo => 'bar'); my $foo = $cache->get('foo');
ОПИСАНИЕ
Mojo::Cache is a naive in-memory cache with size limits.
Note that this module is EXPERIMENTAL and might change without warning!
АТРИБУТЫ
Mojo::Cache implements the following attributes.
max_keys
my $max_keys = $cache->max_keys; $cache = $cache->max_keys(50);
Maximum number of cache keys, defaults to 100
.
МЕТОДЫ
Mojo::Cache inherits all methods from Mojo::Base and implements the following new ones.
get
my $value = $cache->get('foo');
Get cached value.
set
$cache = $cache->set(foo => 'bar');
Set cached value.