Code Documentation¶
Module¶
Redis Client for embedded python environments
-
class
uredis_modular.list.List(host=None, port=6379, password=None)[source]¶ Bases:
uredis_modular.client.ClientRedis Client with support for all Redis List operations
-
blpop(*keys, **kwargs)[source]¶ Remove and get the first element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpop(*keys, **kwargs)[source]¶ Remove and get the last element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpoplpush(src, dst, timeout=0)[source]¶ Remove and get the last element of a list and push it to the front of another list, blocking if there is no value to available.
Parameters: Returns: The bytestring of the value retrievied from the src
Return type: bytes
-
convert_to_bytestream(value)¶ Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-
uredis.Redis() Class¶
-
class
uredis.Redis(host=None, port=6379, password=None)[source]¶ Bases:
uredis_modular.connection.Connection,uredis_modular.geo.Geo,uredis_modular.hash.Hash,uredis_modular.key.Key,uredis_modular.list.List,uredis_modular.pubsub.PubSub,uredis_modular.set.Set,uredis_modular.sortedset.SortedSet,uredis_modular.string.StringPrimary Redis Client Class.
This class provides a Redis Client with all the functionality of the supported subclasses.
This class is intended to be mostly compatible with the redis-py redis.Redis()/redis.StrictRedis() classes.
-
auth(password)¶ Authenticate to the server
Parameters: password (str) – The password to authenticate with
-
blpop(*keys, **kwargs)¶ Remove and get the first element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpop(*keys, **kwargs)¶ Remove and get the last element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpoplpush(src, dst, timeout=0)¶ Remove and get the last element of a list and push it to the front of another list, blocking if there is no value to available.
Parameters: Returns: The bytestring of the value retrievied from the src
Return type: bytes
-
convert_to_bytestream(value)¶ Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-
geoadd(*args)¶ Add one or more geospatial items in the geospatial index represented using a sorted set
Parameters: *args – key longitude latitude member [longitude latitude member ...] Returns: The number of elements added to the sorted set, not including elements already existing for which the score was updated. Return type: int
-
geodist(*args)¶ Returns the distance between two members of a geospatial index
Parameters: *args – key member1 member2 [unit]
-
geohash(*args)¶ Members of a geospatial index as geohash strings
Parameters: *args – key member [member ...] Returns: Returns members of a geospatial index as standard geohash strings Return type: dict
-
geopos(*args)¶ Return longitude and latitude of members of a geospatial index
Parameters: *args – key member [key member ...] Returns: Returns members of a geospatial index as standard geohash strings Return type: dict
-
georadius(*args)¶ Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point
Parameters: *args – key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]
-
georadiusbymember(*args)¶ Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
Parameters: *args – key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]
-
hgetall(*args)¶ ” Returns all fields and values of the hash stored at key.
Returns: Dictionary of all key/values from the field Return type: dict
-
hincrby(key, field, increment)¶ Increments the number stored at field in the hash stored at key by increment. If key does not exist, a new key holding a hash is created. If field does not exist the value is set to 0 before the operation is performed.
The range of values supported by HINCRBY is limited to 64 bit signed integers.
Parameters: Returns: The value at field after the increment operation.
Return type:
-
ping(*args)¶ Ping the server
-
quit(*args)¶ Close the connection
-
rpop(name)¶ Remove and get the last element of a list
Parameters: name (str) – Key to pop the value from Returns: The bytestring of the value retrievied from the src Return type: bytes
-
select(*args)¶ Change the selected database
Parameters: index (int) – The redis database number to switch to
-
uredis.StrictRedis() Class¶
-
class
uredis.StrictRedis(host=None, port=6379, password=None)[source]¶ Bases:
uredis.uredis.Redis-
auth(password)¶ Authenticate to the server
Parameters: password (str) – The password to authenticate with
-
blpop(*keys, **kwargs)¶ Remove and get the first element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpop(*keys, **kwargs)¶ Remove and get the last element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpoplpush(src, dst, timeout=0)¶ Remove and get the last element of a list and push it to the front of another list, blocking if there is no value to available.
Parameters: Returns: The bytestring of the value retrievied from the src
Return type: bytes
-
convert_to_bytestream(value)¶ Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-
geoadd(*args)¶ Add one or more geospatial items in the geospatial index represented using a sorted set
Parameters: *args – key longitude latitude member [longitude latitude member ...] Returns: The number of elements added to the sorted set, not including elements already existing for which the score was updated. Return type: int
-
geodist(*args)¶ Returns the distance between two members of a geospatial index
Parameters: *args – key member1 member2 [unit]
-
geohash(*args)¶ Members of a geospatial index as geohash strings
Parameters: *args – key member [member ...] Returns: Returns members of a geospatial index as standard geohash strings Return type: dict
-
geopos(*args)¶ Return longitude and latitude of members of a geospatial index
Parameters: *args – key member [key member ...] Returns: Returns members of a geospatial index as standard geohash strings Return type: dict
-
georadius(*args)¶ Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point
Parameters: *args – key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]
-
georadiusbymember(*args)¶ Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
Parameters: *args – key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]
-
hgetall(*args)¶ ” Returns all fields and values of the hash stored at key.
Returns: Dictionary of all key/values from the field Return type: dict
-
hincrby(key, field, increment)¶ Increments the number stored at field in the hash stored at key by increment. If key does not exist, a new key holding a hash is created. If field does not exist the value is set to 0 before the operation is performed.
The range of values supported by HINCRBY is limited to 64 bit signed integers.
Parameters: Returns: The value at field after the increment operation.
Return type:
-
ping(*args)¶ Ping the server
-
quit(*args)¶ Close the connection
-
rpop(name)¶ Remove and get the last element of a list
Parameters: name (str) – Key to pop the value from Returns: The bytestring of the value retrievied from the src Return type: bytes
-
select(*args)¶ Change the selected database
Parameters: index (int) – The redis database number to switch to
-
uredis_modular.connection.Connection() Class¶
-
class
uredis_modular.connection.Connection(host=None, port=6379, password=None)[source]¶ Bases:
uredis_modular.client.Client-
auth(password)[source]¶ Authenticate to the server
Parameters: password (str) – The password to authenticate with
-
convert_to_bytestream(value)¶ Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-
uredis_modular.geo.Geo() Class¶
-
class
uredis_modular.geo.Geo(host=None, port=6379, password=None)[source]¶ Bases:
uredis_modular.client.Client-
convert_to_bytestream(value)¶ Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-
geoadd(*args)[source]¶ Add one or more geospatial items in the geospatial index represented using a sorted set
Parameters: *args – key longitude latitude member [longitude latitude member ...] Returns: The number of elements added to the sorted set, not including elements already existing for which the score was updated. Return type: int
-
geodist(*args)[source]¶ Returns the distance between two members of a geospatial index
Parameters: *args – key member1 member2 [unit]
-
geohash(*args)[source]¶ Members of a geospatial index as geohash strings
Parameters: *args – key member [member ...] Returns: Returns members of a geospatial index as standard geohash strings Return type: dict
-
geopos(*args)[source]¶ Return longitude and latitude of members of a geospatial index
Parameters: *args – key member [key member ...] Returns: Returns members of a geospatial index as standard geohash strings Return type: dict
-
georadius(*args)[source]¶ Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point
Parameters: *args – key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]
-
uredis_modular.hash.Hash() Class¶
-
class
uredis_modular.hash.Hash(host=None, port=6379, password=None)[source]¶ Bases:
uredis_modular.client.Client-
convert_to_bytestream(value)¶ Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-
hgetall(*args)[source]¶ ” Returns all fields and values of the hash stored at key.
Returns: Dictionary of all key/values from the field Return type: dict
-
hincrby(key, field, increment)[source]¶ Increments the number stored at field in the hash stored at key by increment. If key does not exist, a new key holding a hash is created. If field does not exist the value is set to 0 before the operation is performed.
The range of values supported by HINCRBY is limited to 64 bit signed integers.
Parameters: Returns: The value at field after the increment operation.
Return type:
-
uredis_modular.hyperloglog.HyperLogLog() Class¶
uredis_modular.key.Key() Class¶
uredis_modular.list.List() Class¶
-
class
uredis_modular.list.List(host=None, port=6379, password=None)[source] Bases:
uredis_modular.client.ClientRedis Client with support for all Redis List operations
-
blpop(*keys, **kwargs)[source] Remove and get the first element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpop(*keys, **kwargs)[source] Remove and get the last element of a list or block until one is available
Parameters: - *keys – Key or keys to get the first element from
- timeout (int, optional) – Maximum time to block waiting for the key, if not specified will wait forever.
Returns: Return type: First element from the list, or None
-
brpoplpush(src, dst, timeout=0)[source] Remove and get the last element of a list and push it to the front of another list, blocking if there is no value to available.
Parameters: Returns: The bytestring of the value retrievied from the src
Return type: bytes
-
convert_to_bytestream(value) Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-
rpop(name)[source] Remove and get the last element of a list
Parameters: name (str) – Key to pop the value from Returns: The bytestring of the value retrievied from the src Return type: bytes
-
send_redis_array_string(items) Send a redis array string
Parameters: items (list) – The items to be in the redis array string Returns: Redis RESP bytestream representation of the array Return type: bytes
-
uredis_modular.pubsub.PubSub() Class¶
uredis_modular.server.Server() Class¶
uredis_modular.set.Set() Class¶
uredis_modular.sortedset.SortedSet() Class¶
-
class
uredis_modular.sortedset.SortedSet(host=None, port=6379, password=None)[source]¶ Bases:
uredis_modular.client.Client-
convert_to_bytestream(value)¶ Return a bytestream of the value
Parameters: value – Returns: A bytestream of the value Return type: bytes
-