logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

CHI::Driver::FastMmap - Persistent interprocess cache via mmap'ed files

Author

       Jonathan Swartz <swartz@pobox.com>

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. '/tmp' on UNIX).

       dir_create_mode
           Permissions mode to use when creating directories. Defaults to 0775.

       Any other constructor options not recognized by CHI are passed along to Cache::FastMmap->new.

Description

       This cache driver uses Cache::FastMmap to store data in an mmap'ed file. It is very fast, and can be used
       to share data between processes on a single host, though not between hosts.

       To support namespaces, this driver takes a directory parameter rather than a file, and creates one
       Cache::FastMMap file for each namespace.

       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.

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 { ... });

Name

       CHI::Driver::FastMmap - Persistent interprocess cache via mmap'ed files

Requirements

       You will need to install Cache::FastMmap from CPAN to use this driver.

See Also

       CHI

Synopsis

           use CHI;

           my $cache = CHI->new(
               driver     => 'FastMmap',
               root_dir   => '/path/to/cache/root',
               cache_size => '1m'
           );

Version

       version 0.61

See Also