CHI::D...astMmap(3pm)
π CHI::Driver::FastMmap β the perl doc bestie edition π
okay so you're here for CHI::Driver::FastMmap (a.k.a. part of the User Contributed Perl Documentation, 3pm section, iykyk). It's the driver that gives you a persistent interprocess cache via mmap'ed files. Let's go β¨
β¨ VERSION β¨
version 0.61 β she's been through some things and she's thriving π
πΈ SYNOPSIS πΈ
use CHI;
my $cache = CHI->new(
driver => 'FastMmap',
root_dir => '/path/to/cache/root',
cache_size => '1m'
);
look at her. four lines. immaculate. π
π¦ DESCRIPTION π¦
So this cache driver uses Cache::FastMmap to store data in an mmap'ed file. It's very fast, bestie, like actually fast. You can use it to share data between processes on a single host β but not between hosts. Don't try it. She said what she said. π
To support namespaces, this driver takes a directory parameter rather than a file, and creates one Cache::FastMMap file for each namespace. One file per namespace, periodt. π
Because CHI handles serialization automatically, we pass the "serializer" flag as ''; and to conform to the CHI API, we pass "unlink_on_exit" as 0, so that all cache files are permanent. Nothing gets deleted, she's staying, main character energy fr fr. π
π REQUIREMENTS π
You will need to install Cache::FastMmap from CPAN to use this driver. That's it. That's the requirement. Go get her. π«Ά
β¨ CONSTRUCTOR OPTIONS β¨
root_dirβ Path to the directory that will contain the share files, one per namespace. Defaults to a directory called'chi-driver-fastmmap'under the OS default temp directory (e.g./tmpon UNIX). πdir_create_modeβ Permissions mode to use when creating directories. Defaults to0775. π₯
Any other constructor options not recognized by CHI are passed along to Cache::FastMmap->new. So like, if CHI doesn't know her, FastMmap does. π€
π METHODS π
π
fm_cache
Returns a handle to the underlying Cache::FastMmap object. You can use this to call FastMmap-specific methods that are not supported by the general API, e.g.
$self->fm_cache->get_and_set("key", sub { ... });
it's giving backstage pass to the real object. obsessed. π
π SEE ALSO π
CHIβ the whole entire parent vibe, go read her too π¦
π AUTHOR π
Jonathan Swartz <swartz@pobox.com> β thank you legend, we stan π«Άβ¨
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2021 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. So like, it's free free. Slay. π
k that's the whole page bestie, no cap. this was perl v5.32.1 realness, dated 2021-10-15, served up as CHI::D...astMmap(3pm) β mwah, go cache something ππΈ
π¦ where this page comes from
- debian bookworm: libchi-perl 0.61-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libchi-perl 0.61-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libchi-perl 0.61-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libchi-perl 0.61-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libchi-perl 0.61-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libchi-perl 0.61-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