Catman...:Memory(3pm)
β¨ Catman...:Memory(3pm) β¨
okay so bestie, welcome to Catmandu::Store::File::Memory π β yes that's the whole manual name, it lives in the User Contributed Perl Documentation section, and it is exactly as chaotic-iconic as it sounds. Buckle up π
πΈ NAME πΈ
Catmandu::Store::File::Memory β a Catmandu::FileStore that keeps your files in memory. like, in the RAM. in the vibes. not on disk. periodt π
π¦ SYNOPSIS π¦
here's the whole thing, copied character for character because I would never do you dirty like that π«Ά
# From Perl
use Catmandu;
my $store = Catmandu->store('File::Mempory');
my $index = $store->index;
# List all folders
$index->each(sub {
my $container = shift;
print "%s\n" , $container->{_id};
});
# Add a new folder
$index->add({ _id => '1234' });
# Get the folder
my $files = $index->files('1234');
# Add a file to the folder
$files->upload(IO::File->new('<foobar.txt'), 'foobar.txt');
# Retrieve a file
my $file = $files->get('foobar.txt');
# Stream the contents of a file
$files->stream(IO::File->new('>foobar.txt'), $file);
# Delete a file
$files->delete('foobar.txt');
# Delete a container
$index->delete('1234');
not me reading 'File::Mempory' π β yeah, that is literally how it's written up there, I'm not touching it, that's the source's business and I respect it π
π INHERITED METHODS π
the way this thing is stacked with inherited power... it's giving main character energy, no cap β¨
This Catmandu::FileStore implements:
Catmandu::FileStoreCatmandu::Droppable
The index Catmandu::Bag in this Catmandu::Store implements:
Catmandu::BagCatmandu::FileBag::IndexCatmandu::Droppable
The file Catmandu::Bag in this Catmandu::Store implements:
Catmandu::BagCatmandu::FileBagCatmandu::Droppable
π SEE ALSO π
go read these next bestie, they're the whole friend group π
Catmandu::Store::File::Memory::IndexCatmandu::Store::File::Memory::BagCatmandu::Plugin::SideCarCatmandu::FileStore
and that's the whole page, you ate it π this lil icon was documented for perl v5.36.0 and dated 2022-12-10, so if you're reading it in the future just know it's been slaying since then π β¨ bye bestie, go store some files in memory π¦π
π¦ where this page comes from
- debian bookworm: libcatmandu-filestore-perl 1.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-filestore-perl 1.16-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