Arch::...edCache(3pm)

πŸ“¦ version 0.5.2, in ubuntu jammy

✨ Arch::SharedCache β€” the perl doc page πŸ’–

okay bestie, gather round, because this is Arch::...edCache(3pm) from the User Contributed Perl Documentation and it is lowkey iconic. it's a synchronized data structure (a map, bestie, a map) for IPC. yes we love inter-process communication in this house 🫢


🌸 NAME 🌸

Arch::SharedCache β€” a synchronized data structure (map) for IPC ✨


πŸŽ€ SYNOPSIS πŸŽ€

use Arch::SharedCache;

my $cache = Arch::SharedCache->new(
    dir => '/tmp/dir-listings',
    max_size   => 100,
    expiration => 600,  # 10 minutes
);

sub ls_long { scalar `ls -l $_[0]` }

my $user_dir = '/usr/share';
$cache->store($user_dir => ls_long($user_dir));
$cache->fetch_store(sub { ls_long($_[0]) }, qw(/tmp /bin /usr/share));
printf "Cached listing of $user_dir:\n%s", $cache->fetch($user_dir);
$cache->delete($user_dir);

# examine /tmp/dir-listings/ after running this script
# see also synopsys of Arch::SharedIndex

like… run this script and then literally go poke around /tmp/dir-listings/ with your own two eyes, it's giving main character investigates her own cache πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: Arch::SharedCache provides an Arch::SharedIndex implementation that uses a single file per value. one value, one file. that's it. that's the whole personality. no cap 🌈


πŸ‘‘ METHODS πŸ‘‘

the following methods are available:

  • new β€” the constructor, obviously. she's the moment.

other methods are documented in Arch::SharedIndex. not me gatekeeping the rest of the methods by pointing you at a different manpage 😭 go read it bestie.

πŸ’œ new options πŸ’œ

create a new Arch::SharedCache object. options is a hash of options. like, an actual hash, of options. options-ception fr fr.

  • dir β€” the cache directory used to store data. will be created if it doesn't exist. she makes herself at home, we love a self-sufficient queen πŸ‘‘
  • index_file β€” name of the index file for the cache. defaults to "dir/.index". yes, that's dir slash .index, note the dot, note the slashes, copy it exactly please πŸŽ€

πŸ’€ BUGS πŸ’€

awaiting for your reports.

(that's it. that's the bug section. the bug is that there are no bugs reported yet and she is awaiting. the suspense is giving thriller movie πŸ“)


🌟 AUTHORS 🌟

  • Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel). πŸ‘‘
  • Enno Cramer (uebergeek@web.de--2003/arch-perl--devel). πŸ‘‘

two absolute legends, we stan, periodt.


🌈 SEE ALSO 🌈

for more information, see Arch::SharedIndex. (iykyk πŸ’–)


okay and finally, the cute little sign-off: this page is from perl v5.20.2, dated 2005-09-17, and it lives under the title Arch::...edCache(3pm) πŸ¦‹βœ¨ mwah, go cache something responsibly bestie 🫢

πŸ“¦ where this page comes from