ShardedKV::Storage::Redis - Abstract base class for storing k/v pairs in Redis
version 0.17
# use a subclass instead
This class consumes the ShardedKV::Storage role. It is an abstract base class for storing key-value pairs in Redis. It does not actually implement the get() and set() methods and does not impose a Redis value type. Different subclasses of this class are expected to represent different storages for distinct Redis value types.
get()
set()
A hostname:port string pointing at the Redis for this shard. Required.
The Redis object that represents the connection. Will be generated from the redis_connect_str attribute and may be reset/reconnected at any time.
Redis
redis_connect_str
Base key expiration time to use in seconds. Defaults to undef / not expiring at all.
Additional random jitter to add to the expiration time. Defaults to 0. Don't set to undef to disable, set to 0 to disable.
Indicates the number of the Redis database to use for this shard. If undef/non-existant, no specific database will be selected, so the Redis server will use the default.
Implemented in the base class, this method deletes the given key from the Redis shard.
Not implemented in the base class. This method is supposed to fetch a value back from Redis. Beware: Depending on the ShardedKV::Storage::Redis subclass, the reference type that this method returns may vary. For example, if you use ShardedKV::Storage::Redis::String, the return value will be a scalar reference to a string. For ShardedKV::String::Redis::Hash, the return value is unsurprisingly a hash reference.
ShardedKV::Storage::Redis
ShardedKV::Storage::Redis::String
ShardedKV::String::Redis::Hash
The counterpart to get. Expects values as second argument. The value must be of the same reference type that is returned by get().
get
ShardedKV
ShardedKV::Storage
ShardedKV::Storage::Redis::Hash
# vim: ts=2 sw=2 et
Steffen Mueller <smueller@cpan.org>
Nick Perez <nperez@cpan.org>
This software is copyright (c) 2013 by Steffen Mueller.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install ShardedKV, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ShardedKV
CPAN shell
perl -MCPAN -e shell install ShardedKV
For more information on module installation, please visit the detailed CPAN module installation guide.