1CHI::Driver::FastMmap(3U)ser Contributed Perl DocumentatiCoHnI::Driver::FastMmap(3)
2
3
4
6 CHI::Driver::FastMmap - Persistent interprocess cache via mmap'ed files
7
9 version 0.61
10
12 use CHI;
13
14 my $cache = CHI->new(
15 driver => 'FastMmap',
16 root_dir => '/path/to/cache/root',
17 cache_size => '1m'
18 );
19
21 This cache driver uses Cache::FastMmap to store data in an mmap'ed
22 file. It is very fast, and can be used to share data between processes
23 on a single host, though not between hosts.
24
25 To support namespaces, this driver takes a directory parameter rather
26 than a file, and creates one Cache::FastMMap file for each namespace.
27
28 Because CHI handles serialization automatically, we pass the
29 "serializer" flag as ''; and to conform to the CHI API, we pass
30 "unlink_on_exit" as 0, so that all cache files are permanent.
31
33 You will need to install Cache::FastMmap from CPAN to use this driver.
34
36 root_dir
37 Path to the directory that will contain the share files, one per
38 namespace. Defaults to a directory called 'chi-driver-fastmmap'
39 under the OS default temp directory (e.g. '/tmp' on UNIX).
40
41 dir_create_mode
42 Permissions mode to use when creating directories. Defaults to
43 0775.
44
45 Any other constructor options not recognized by CHI are passed along to
46 Cache::FastMmap->new.
47
49 fm_cache
50 Returns a handle to the underlying Cache::FastMmap object. You can
51 use this to call FastMmap-specific methods that are not supported
52 by the general API, e.g.
53
54 $self->fm_cache->get_and_set("key", sub { ... });
55
57 CHI
58
60 Jonathan Swartz <swartz@pobox.com>
61
63 This software is copyright (c) 2021 by Jonathan Swartz.
64
65 This is free software; you can redistribute it and/or modify it under
66 the same terms as the Perl 5 programming language system itself.
67
68
69
70perl v5.38.0 2023-07-20 CHI::Driver::FastMmap(3)