OpenResty::Cache - Cache for OpenResty
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');
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.
cache.type
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).
filecache
memcached
cache.servers
Agent Zhang (agentzh) <agentzh@yahoo.cn>.
<agentzh@yahoo.cn>
OpenResty, Cache::FileCache, Cache::Memcached::libmemcached.
To install OpenResty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenResty
CPAN shell
perl -MCPAN -e shell install OpenResty
For more information on module installation, please visit the detailed CPAN module installation guide.