clients.redis

Base functionality for accessing/modifying data in Redis. Currently the supported functionality is accessing Redis in a sharded manner.

class sprockets.clients.redis.RedisConnection

Maintain a Redis connection.

This class establishes a redis connection based off of the IP address resolved from the hostname part of the REDIS_URI environment variable

Note

The hostname in the REDIS_URI will be DNS resolved and a connection will be opened for the address returned in the answer section.

class sprockets.clients.redis.ShardedRedisConnection

Maintain a list of several Redis backends in a sharded manner.

This class establishes several pools based off of the IP addresses resolved from the hostname part of the REDIS_URI environment variable. Any reads, writes, or deletes will be delegated to the proper Redis backend by determining which shard the query should be directed to.

Additionally, the info method is available to gather health information across all of the servers in the backend. This data can be used to determine the health of the service.

Note

The hostname in the REDIS_URI will be DNS resolved and a connection will be opened for each address returned in the answer section. You can specify a Round-Robin DNS record and we will open a connection to all hosts returned.

delete(key)

Delete a key in a Redis shard.

get(key)

Get a key in a Redis shard.

info()

Return a list of the health of each connected redis server.

Return type:list
Returns:A list of the server info from all of the server shards.
sadd(key, *values)

Add the specified values to the set stored at key.

set(key, value, ttl=None)

Set key to value in a Redis shard.

sismember(key, member)

Returns if member is a member of the set stored at key.

smembers(key)

Return all members of the set stored at key.