Yichun Zhang (章亦春)
and 1 contributors

NAME

OpenResty::Cache - Cache for OpenResty

SYNOPSIS

    use OpenResty::Config;
    use OpenResty::Cache;

    OpenResty::Config->init;
    my $cache = OpenResty::Cache->new;
    $cache->set('key' => 'value'); # use the cache to store (session) data
    $cache->set('key' => 'value', 'trivial'); # pure caching
    print $cache->get('key');  # read the value for the key
    $cache->remove('key');

DESCRIPTION

This class provides an abstract interface for two caching libraries, Cache::FileCache and Cache::Memcached::libmemcached.

Which underlying cache library to use depends on the cache.type config option in the etc/site_openresty.conf file.

Note that filecache could eat up your hard disk very quickly. (you'll observe the bloating directory /tmp/FileCache.) filecache is only suitable for development; for production use, please use memcached instead (by specifying the cache.type and cache.servers options in etc/site_openresty.conf).

METHODS

AUTHOR

Agent Zhang (agentzh) <agentzh@yahoo.cn>.

SEE ALSO

OpenResty, Cache::FileCache, Cache::Memcached::libmemcached.