Cache::Memory(3pm)
π NAME π
okay so Cache::Memory β it's the memory-based implementation of the Cache interface bestie!! that's the whole vibe. it lives in the Cache::Memory manual page (3pm), user contributed perl docs, you know the drill β¨
β¨ SYNOPSIS β¨
like, literally the bare minimum to get going:
use Cache::Memory;
my $cache = Cache::Memory->new( namespace => 'MyNamespace',
default_expires => '600 sec' );
and for the full usage tea, go read Cache β the synopsis lives there π«Ά
πΈ DESCRIPTION πΈ
so Cache::Memory implements the Cache interface. no cap. and here's the thing: this cache stores data on a per-process basis. it's giving speed demon because it is the fastest of the cache implementations π₯ but bestieβ¦ it's memory intensive π and the data can not be shared between processes. it also does not persist after the process dies π
BUT β and this is the part where she ate β the data will remain in the cache until cleared or it expires β¨ and it gets shared between instances of the cache object, so a cache object going out of scope will not destroy the data. iconic behaviour honestly π
π CONSTRUCTOR π
my $cache = Cache::Memory->new( %options )
the constructor takes cache properties as named arguments, like so:
my $cache = Cache::Memory->new( namespace => 'MyNamespace',
default_expires => '600 sec' );
peep the PROPERTIES section below (and the Cache documentation) for the full list of every property you can set π
π¦ METHODS π¦
go read Cache for the API documentation, that's where the whole method menu lives β¨
π PROPERTIES π
Cache::Memory adds the property 'namespace' β which lets you specify a different caching store area to use instead of the default. and listen: all methods will work ONLY on the namespace specified. periodt.
my $ns = $c->namespace();
$c->set_namespace( $namespace );
for additional properties, check the Cache documentation π«Ά
π SEE ALSO π
Cache
π AUTHOR π
- Chris Leishman
<chris@leishman.org> - Based on work by DeWitt Clinton
<dewitt@unto.net>
π COPYRIGHT π
Copyright (C) 2003-2006 Chris Leishman. All Rights Reserved.
this module is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. this program is free software; you can redistribute or modify it under the same terms as Perl itself π
$Id: Memory.pm,v 1.9 2006/01/31 15:23:58 caleishm Exp $
ngl the "AS IS" / no-warranty bit is the real one β take it seriously even though we're being cute about it π
okay bestie that's the whole page, love u, go cache responsibly ππ§ this was Cache::Memory from the perl v5.34.0 docs, dated 2022-06-09, and yes she's serving Cache::Memory(3pm) energy the entire time π
β¨ mwah π
π¦ where this page comes from
- debian bookworm: libcache-perl 2.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcache-perl 2.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcache-perl 2.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcache-perl 2.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcache-perl 2.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms