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
hostnamepart of theREDIS_URIenvironment variableNote
The hostname in the
REDIS_URIwill 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
hostnamepart of theREDIS_URIenvironment 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
infomethod 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_URIwill 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
keyin a Redis shard.
-
get(key)¶ Get a
keyin 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
valuesto the set stored atkey.
-
set(key, value, ttl=None)¶ Set
keytovaluein a Redis shard.
-
sismember(key, member)¶ Returns if
memberis a member of the set stored atkey.
-
smembers(key)¶ Return all members of the set stored at
key.
-