Cache-RedisDB

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME

    Cache::RedisDB - RedisDB based cache system

DESCRIPTION

    This is just a wrapper around RedisDB to have a single Redis object and
    connection per process. By default uses server redis://127.0.0.1, but
    it may be overwritten by REDIS_CACHE_SERVER environment variable. It
    transparently handles forks.

COMPATIBILITY AND REQUIREMENTS

    Redis 2.6.12 and higher strongly recommended. Required if you want to
    use extended options in ->set().

SYNOPSIS

        use Cache::RedisDB;
        Cache::RedisDB->set("namespace", "key", "value");
        Cache::RedisDB->get("namespace", "key");

METHODS

 redis_uri

    Returns a redis:// redis URI which will be used for the initial Redis
    connection.

    This will default to localhost on the standard port, and can be
    overridden with the REDIS_CACHE_SERVER environment variable.

 redis_connection

    Creates new connection to a Redis server and returns the corresponding
    RedisDB object.

 redis

    Returns a singleton RedisDB instance.

 get

    Takes a $namespace and $key parameter, and returns the scalar value
    corresponding to that cache entry.

    This will automatically deserialise data stored with Sereal. If no data
    is found, this will return undef.

 mget

    Retrieve values for multiple keys in a single call.

    Similar to "get", this takes a $namespace as the first parameter, but
    it also accepts a list of @keys to look up.

    Returns an arrayref in the same order as the original keys. For any key
    that had no value, the resulting arrayref will contain undef.

 set

    Creates or updates a Redis key under $namespace, $key using the scalar
    $value. Also takes an optional $exptime as expiration time in seconds.

     $redis->set($namespace, $key, $value);
     $redis->set($namespace, $key, $value, $expiry_time);

    Can also be provided a callback which will be executed once the command
    completes.



( run in 1.356 second using v1.01-cache-2.11-cpan-39bf76dae61 )