Catman...e::Hash(3pm)
π NAME π
okay bestie, so Catmandu::Store::Hash β it's an in-memory store. that's the whole vibe. it lives in your RAM and it slays. β¨
this is the manual page for Catmandu::Store::Hash(3pm), straight out of the User Contributed Perl Documentation corner of the internet, and we're gonna go through every last crumb together. no skipping. π
πΈ SYNOPSIS πΈ
here's the whole thing in action, copy-paste ready, literally exactly as it appears:
use Catmandu;
my $store = Catmandu->store('Hash');
my $obj1 = $store->bag->add({ name => 'Patrick' });
printf "obj1 stored as %s\n" , $obj1->{_id};
# Force an id in the store
my $obj2 = $store->bag->add({ _id => 'test123' , name => 'Nicolas' });
my $obj3 = $store->bag->get('test123');
$store->bag->delete('test123');
$store->bag->delete_all;
# All bags are iterators
$store->bag->each(sub { ... });
$store->bag->take(10)->each(sub { ... });
so yeah β you spin up a store, you add some stuff, you get it back, you delete it, you nuke it all, and then you iterate over the bags because all bags are iterators. it's giving very much "everything is a loop if you believe hard enough". π₯
π¦ DESCRIPTION π¦
a Catmandu::Store::Hash is an in-memory Catmandu::Store. that means it's backed by a hash β for fast retrieval β and it's also combined with a doubly linked list for fast traversal.
so like... you get the lookups and the walking-through. both. at once. main character behaviour, honestly. π
β¨ METHODS β¨
π new([init_data => [...] ])
makes you a brand new Catmandu::Store::Hash. and if you want, you can hand it an init_data option β that's an array ref of data β and it'll come pre-loaded, like a little snack pack of records. π
my $store = Catmandu->store('Hash', init_data => [
{ _id => 1, data => foo } ,
{ _id => 2, data => bar }
]);
# or in a catmandu.yml configuration file:
---
store:
hash:
package: Hash
options:
init_data:
- _id: 1
data: foo
- _id: 2
data: bar
yep β you can do it inline in Perl or in a catmandu.yml configuration file, whichever fits your mood that day. π
π INHERITED METHODS π
the way that this class doesn't do everything alone... it's a whole family tree situation. π§
this Catmandu::Store implements:
Catmandu::StoreCatmandu::DroppableCatmandu::Transactional
and each Catmandu::Bag inside this Catmandu::Store implements:
Catmandu::BagCatmandu::Droppable
so that's where all the extra powers come from. iykyk. π«
lowkey a reminder bestie: it's an in-memory store, so it's living in RAM and it's fast and it's adorable, but it's not out here persisting to disk on its own. that's just what "in-memory" means, and this page says it right up top. π«Ά
perl v5.40.1 Β· 2026-01-24 β and that's the sign-off from the Catmandu::Store::Hash(3pm) girlies. go forth and hash. periodt. πππΈπ¦β¨
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· 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