Cataly...stMmap(3pm)
π Catalyst::Plugin::Session::Store::FastMmap π
okay bestie, gather round, because this one is a Perl module and it's User Contributed Perl Documentation, so it lives in section 3pm of your manual pages. Yes, the whole name is a mouthful, we know β it's Catalyst::Plugin::Session::Store::FastMmap and honestly the name alone is doing cardio. But it's giving fast session storage and we're gonna stan. π«Ά
β¨ NAME β¨
Catalyst::Plugin::Session::Store::FastMmap β the fast session storage backend, bestie. It stores your sessions, it does it fast, and that's the whole vibe. π
πΈ SYNOPSIS πΈ
here's how you actually use it, no cap:
use Catalyst qw/Session Session::Store::FastMmap Session::State::Foo/;
MyApp->config(
'Plugin::Session' => {
expires => 3600,
storage => '/tmp/session'
},
);
# ... in an action:
$c->session->{foo} = 'bar'; # will be saved
see that last line? you just drop stuff into $c->session->{foo} and it literally gets saved. iconic behaviour, no notes. π
π¦ DESCRIPTION π¦
Catalyst::Plugin::Session::Store::FastMmap is a fast session storage plugin for Catalyst that uses an mmap'ed file to act as a shared memory interprocess cache. She's based on Cache::FastMmap, and yes she's fast, it's in the name, we've been over this. β
π METHODS π
get_session_datastore_session_datadelete_session_datadelete_expired_sessions
These four are the implementations of the required methods for a store. Wanna know the tea? Go read Catalyst::Plugin::Session::Store. π
get_and_set_session_data
This is the optional method for atomic write semantics. See Catalyst::Plugin::Session::AtomicWrite for the details, iykyk. π₯
setup_session
Sets up the session cache file. That's the whole job. She's doing great. π
π CAVEATS π
okay so this is the part where we get real, because there are some actual dangers here and I need you to lock in. π¨
Very loaded sites with lots of data in the session hash may have old sessions expired prematurely, due to the LRU caching policy employed by Cache::FastMmap. To get around this you can increase the "cache_size" parameter, or switch session storage backends. And btw, Cache::FastMmap defaults to around 5mb (89 * 64k) β so yeah, that's the starting point, plan accordingly bestie.
This is particularly inappropriate for use as a backend for e.g. Catalyst::Plugin::Session::PerUser, for example. Just don't do it. I'm begging. π
As Cache::FastMmap is not "thread-safe" (at least version 1.30 and before) therefore also this module does not work in multi-threaded environment. It is "fork-safe", however keep in mind that on Win32 the perl fork call is implemented as an emulation via threads β that is the reason why you cannot use this store for example when running you catalyst application on Win32 platform with Catalyst::Engine::HTTP::Prefork engine.
fr fr: multi-threaded = nope. Win32 + Catalyst::Engine::HTTP::Prefork = also nope. this is not a drill. π
π CONFIGURATION π
These parameters are placed in the hash under the "Plugin::Session" key in the configuration hash. So like, that's where they live. That's their home. π
storageβ Specifies the file to be used for the sharing of session data. The default value will useFile::Specto find the default tempdir, and use a file named"MyApp_session_data", where"MyApp"is replaced with the appname.
Important heads up: the file will be created with mode0640, which means that it will only be writeable by processes running with the same uid as the process that creates the file. If this may be a problem, for example if you may try to debug the program as one user and run it as another, specify a filename like"/tmp/session-$>", which includes the UID of the process in the filename. sneaky but slay. π
init_filecache_sizeunlink_on_exit
See the Cache::FastMmap documentation for the meaning of these keys. If these keys are not present, Cache::FastMmap's defaults will be used. Simple as that. β¨
π SEE ALSO π
CatalystCatalyst::Plugin::SessionCache::FastMmap
go read them, they're the supporting cast and they ate. π
π«Ά AUTHORS π«Ά
This module is derived from Catalyst::Plugin::Session::FastMmap code, and has been heavily modified since. The way that this list of legends carried this whole thingβ¦ π
Andrew Ford
Andy Grundman
Christian Hansen
Yuval Kogman, <nothingmuch@woobling.org>
Marcus Ramberg
Sebastian Riedel
Tomas Doran, (t0m) <bobtfish@bobtfish.net>
π COPYRIGHT π
Copyright (c) 2005 - 2012 the Catalyst::Plugin::Session::Store::FastMmap "AUTHORS" as listed above.
π LICENSE π
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. periodt. π
and that's the whole page bestie!! this was perl v5.34.0, dated 2022-06-09, from the Catalyst::Plugin::Session::Store::FastMmap manual in section 3pm β thanks for reading, mwah, go forth and store your sessions fast. ππ¦πΈ
π¦ where this page comes from
- debian bookworm: libcatalyst-plugin-session-store-fastmmap-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-plugin-session-store-fastmmap-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-plugin-session-store-fastmmap-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-plugin-session-store-fastmmap-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-plugin-session-store-fastmmap-perl 0.16-3 Β· 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