VERSION

version 0.58

SYNOPSIS

    use CHI;

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

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 \s-1CHI\s0 handles serialization automatically, we pass the \*(C`raw_values\*(C' flag as 1; and to conform to the \s-1CHI\s0 \s-1API\s0, we pass \*(C`unlink_on_exit\*(C' as 0, so that all cache files are permanent.

REQUIREMENTS

You will need to install Cache::FastMmap from \s-1CPAN\s0 to use this driver.

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 \s-1OS\s0 default temp directory (e.g. '/tmp' on \s-1UNIX\s0).

dir_create_mode

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

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

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 \s-1API\s0, e.g. $self->fm_cache->get_and_set("key", sub { ... });

RELATED TO CHI::Driver::FastMmap…

\s-1CHI\s0

AUTHOR

Jonathan Swartz <[email protected]>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 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.