Catman...:Memory(3pm)

πŸ“¦
version 1.16 Β· 4 versions
, in debian bookworm, ubuntu noble

✨ 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::FileStore
  • Catmandu::Droppable

The index Catmandu::Bag in this Catmandu::Store implements:

  • Catmandu::Bag
  • Catmandu::FileBag::Index
  • Catmandu::Droppable

The file Catmandu::Bag in this Catmandu::Store implements:

  • Catmandu::Bag
  • Catmandu::FileBag
  • Catmandu::Droppable

πŸ’œ SEE ALSO πŸ’œ

go read these next bestie, they're the whole friend group 🌈

  • Catmandu::Store::File::Memory::Index
  • Catmandu::Store::File::Memory::Bag
  • Catmandu::Plugin::SideCar
  • Catmandu::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