Implementation of the Redis protocol. This abstract class provides a Python interface to all Redis commands and an implementation of the Redis protocol. Connection and Pipeline derive from this, implementing how the commands are sent and received to the Redis server
def redis.client.StrictRedis.__getitem__ | ( | self, | |
name | |||
) |
def redis.client.StrictRedis._zaggregate | ( | self, | |
command, | |||
dest, | |||
keys, | |||
aggregate = None |
|||
) | [private] |
def redis.client.StrictRedis.append | ( | self, | |
key, | |||
value | |||
) |
def redis.client.StrictRedis.bgrewriteaof | ( | self | ) |
def redis.client.StrictRedis.bgsave | ( | self | ) |
def redis.client.StrictRedis.bitcount | ( | self, | |
key, | |||
start = None , |
|||
end = None |
|||
) |
def redis.client.StrictRedis.bitop | ( | self, | |
operation, | |||
dest, | |||
keys | |||
) |
def redis.client.StrictRedis.blpop | ( | self, | |
keys, | |||
timeout = 0 |
|||
) |
LIST COMMANDS ####.
LPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to LPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeout is 0, then block indefinitely.
def redis.client.StrictRedis.brpop | ( | self, | |
keys, | |||
timeout = 0 |
|||
) |
def redis.client.StrictRedis.brpoplpush | ( | self, | |
src, | |||
dst, | |||
timeout = 0 |
|||
) |
def redis.client.StrictRedis.config_get | ( | self, | |
pattern = "*" |
|||
) |
def redis.client.StrictRedis.config_set | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.dbsize | ( | self | ) |
def redis.client.StrictRedis.debug_object | ( | self, | |
key | |||
) |
def redis.client.StrictRedis.decr | ( | self, | |
name, | |||
amount = 1 |
|||
) |
def redis.client.StrictRedis.delete | ( | self, | |
names | |||
) |
def redis.client.StrictRedis.echo | ( | self, | |
value | |||
) |
def redis.client.StrictRedis.eval | ( | self, | |
script, | |||
numkeys, | |||
keys_and_args | |||
) |
Execute the LUA ``script``, specifying the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. In practice, use the object returned by ``register_script``. This function exists purely for Redis API completion.
def redis.client.StrictRedis.evalsha | ( | self, | |
sha, | |||
numkeys, | |||
keys_and_args | |||
) |
Use the ``sha`` to execute a LUA script already registered via EVAL or SCRIPT LOAD. Specify the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. In practice, use the object returned by ``register_script``. This function exists purely for Redis API completion.
def redis.client.StrictRedis.execute_command | ( | self, | |
args, | |||
options | |||
) |
def redis.client.StrictRedis.exists | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.expire | ( | self, | |
name, | |||
time | |||
) |
def redis.client.StrictRedis.expireat | ( | self, | |
name, | |||
when | |||
) |
def redis.client.StrictRedis.flushall | ( | self | ) |
def redis.client.StrictRedis.flushdb | ( | self | ) |
def redis.client.StrictRedis.from_url | ( | cls, | |
url, | |||
db = None , |
|||
kwargs | |||
) |
Return a Redis client object configured from the given URL. For example:: redis://username:password@localhost:6379/0 If ``db`` is None, this method will attempt to extract the database ID from the URL path component. Any additional keyword arguments will be passed along to the Redis class's initializer.
def redis.client.StrictRedis.get | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.getbit | ( | self, | |
name, | |||
offset | |||
) |
def redis.client.StrictRedis.getrange | ( | self, | |
key, | |||
start, | |||
end | |||
) |
def redis.client.StrictRedis.getset | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.hdel | ( | self, | |
name, | |||
keys | |||
) |
def redis.client.StrictRedis.hexists | ( | self, | |
name, | |||
key | |||
) |
def redis.client.StrictRedis.hget | ( | self, | |
name, | |||
key | |||
) |
def redis.client.StrictRedis.hgetall | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.hincrby | ( | self, | |
name, | |||
key, | |||
amount = 1 |
|||
) |
def redis.client.StrictRedis.hkeys | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.hlen | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.hmget | ( | self, | |
name, | |||
keys, | |||
args | |||
) |
def redis.client.StrictRedis.hmset | ( | self, | |
name, | |||
mapping | |||
) |
def redis.client.StrictRedis.hset | ( | self, | |
name, | |||
key, | |||
value | |||
) |
def redis.client.StrictRedis.hsetnx | ( | self, | |
name, | |||
key, | |||
value | |||
) |
def redis.client.StrictRedis.hvals | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.incr | ( | self, | |
name, | |||
amount = 1 |
|||
) |
def redis.client.StrictRedis.info | ( | self | ) |
def redis.client.StrictRedis.keys | ( | self, | |
pattern = '*' |
|||
) |
def redis.client.StrictRedis.lastsave | ( | self | ) |
def redis.client.StrictRedis.lindex | ( | self, | |
name, | |||
index | |||
) |
def redis.client.StrictRedis.linsert | ( | self, | |
name, | |||
where, | |||
refvalue, | |||
value | |||
) |
def redis.client.StrictRedis.llen | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.lock | ( | self, | |
name, | |||
timeout = None , |
|||
sleep = 0.1 |
|||
) |
Return a new Lock object using key ``name`` that mimics the behavior of threading.Lock. If specified, ``timeout`` indicates a maximum life for the lock. By default, it will remain locked until release() is called. ``sleep`` indicates the amount of time to sleep per loop iteration when the lock is in blocking mode and another client is currently holding the lock.
def redis.client.StrictRedis.lpop | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.lpush | ( | self, | |
name, | |||
values | |||
) |
def redis.client.StrictRedis.lpushx | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.lrange | ( | self, | |
name, | |||
start, | |||
end | |||
) |
def redis.client.StrictRedis.lrem | ( | self, | |
name, | |||
count, | |||
value | |||
) |
Remove the first ``count`` occurrences of elements equal to ``value`` from the list stored at ``name``. The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to tail. count < 0: Remove elements equal to value moving from tail to head. count = 0: Remove all elements equal to value.
Reimplemented in redis.client.Redis.
def redis.client.StrictRedis.lset | ( | self, | |
name, | |||
index, | |||
value | |||
) |
def redis.client.StrictRedis.ltrim | ( | self, | |
name, | |||
start, | |||
end | |||
) |
def redis.client.StrictRedis.mget | ( | self, | |
keys, | |||
args | |||
) |
def redis.client.StrictRedis.move | ( | self, | |
name, | |||
db | |||
) |
def redis.client.StrictRedis.mset | ( | self, | |
mapping | |||
) |
def redis.client.StrictRedis.msetnx | ( | self, | |
mapping | |||
) |
def redis.client.StrictRedis.object | ( | self, | |
infotype, | |||
key | |||
) |
def redis.client.StrictRedis.parse_response | ( | self, | |
connection, | |||
command_name, | |||
options | |||
) |
def redis.client.StrictRedis.persist | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.ping | ( | self | ) |
def redis.client.StrictRedis.pipeline | ( | self, | |
transaction = True , |
|||
shard_hint = None |
|||
) |
Return a new pipeline object that can queue multiple commands for later execution. ``transaction`` indicates whether all commands should be executed atomically. Apart from making a group of operations atomic, pipelines are useful for reducing the back-and-forth overhead between the client and server.
Reimplemented in redis.client.Redis.
def redis.client.StrictRedis.publish | ( | self, | |
channel, | |||
message | |||
) |
def redis.client.StrictRedis.pubsub | ( | self, | |
shard_hint = None |
|||
) |
def redis.client.StrictRedis.randomkey | ( | self | ) |
def redis.client.StrictRedis.register_script | ( | self, | |
script | |||
) |
def redis.client.StrictRedis.rename | ( | self, | |
src, | |||
dst | |||
) |
def redis.client.StrictRedis.renamenx | ( | self, | |
src, | |||
dst | |||
) |
def redis.client.StrictRedis.rpop | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.rpoplpush | ( | self, | |
src, | |||
dst | |||
) |
def redis.client.StrictRedis.rpush | ( | self, | |
name, | |||
values | |||
) |
def redis.client.StrictRedis.rpushx | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.sadd | ( | self, | |
name, | |||
values | |||
) |
def redis.client.StrictRedis.save | ( | self | ) |
def redis.client.StrictRedis.scard | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.script_exists | ( | self, | |
args | |||
) |
def redis.client.StrictRedis.script_flush | ( | self | ) |
def redis.client.StrictRedis.script_kill | ( | self | ) |
def redis.client.StrictRedis.script_load | ( | self, | |
script | |||
) |
def redis.client.StrictRedis.sdiff | ( | self, | |
keys, | |||
args | |||
) |
def redis.client.StrictRedis.sdiffstore | ( | self, | |
dest, | |||
keys, | |||
args | |||
) |
def redis.client.StrictRedis.set | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.set_response_callback | ( | self, | |
command, | |||
callback | |||
) |
def redis.client.StrictRedis.setbit | ( | self, | |
name, | |||
offset, | |||
value | |||
) |
def redis.client.StrictRedis.setex | ( | self, | |
name, | |||
time, | |||
value | |||
) |
Set the value of key ``name`` to ``value`` that expires in ``time`` seconds. ``time`` can be represented by an integer or a Python timedelta object.
Reimplemented in redis.client.Redis.
def redis.client.StrictRedis.setnx | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.setrange | ( | self, | |
name, | |||
offset, | |||
value | |||
) |
Overwrite bytes in the value of ``name`` starting at ``offset`` with ``value``. If ``offset`` plus the length of ``value`` exceeds the length of the original value, the new value will be larger than before. If ``offset`` exceeds the length of the original value, null bytes will be used to pad between the end of the previous value and the start of what's being injected. Returns the length of the new string.
def redis.client.StrictRedis.shutdown | ( | self | ) |
def redis.client.StrictRedis.sinter | ( | self, | |
keys, | |||
args | |||
) |
def redis.client.StrictRedis.sinterstore | ( | self, | |
dest, | |||
keys, | |||
args | |||
) |
def redis.client.StrictRedis.sismember | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.slaveof | ( | self, | |
host = None , |
|||
port = None |
|||
) |
def redis.client.StrictRedis.smembers | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.smove | ( | self, | |
src, | |||
dst, | |||
value | |||
) |
def redis.client.StrictRedis.sort | ( | self, | |
name, | |||
start = None , |
|||
num = None , |
|||
by = None , |
|||
get = None , |
|||
desc = False , |
|||
alpha = False , |
|||
store = None |
|||
) |
Sort and return the list, set or sorted set at ``name``. ``start`` and ``num`` allow for paging through the sorted data ``by`` allows using an external key to weight and sort the items. Use an "*" to indicate where in the key the item value is located ``get`` allows for returning items from external keys rather than the sorted data itself. Use an "*" to indicate where int he key the item value is located ``desc`` allows for reversing the sort ``alpha`` allows for sorting lexicographically rather than numerically ``store`` allows for storing the result of the sort into the key ``store``
def redis.client.StrictRedis.spop | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.srandmember | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.srem | ( | self, | |
name, | |||
values | |||
) |
def redis.client.StrictRedis.strlen | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.substr | ( | self, | |
name, | |||
start, | |||
end = -1 |
|||
) |
def redis.client.StrictRedis.sunion | ( | self, | |
keys, | |||
args | |||
) |
def redis.client.StrictRedis.sunionstore | ( | self, | |
dest, | |||
keys, | |||
args | |||
) |
def redis.client.StrictRedis.time | ( | self | ) |
def redis.client.StrictRedis.transaction | ( | self, | |
func, | |||
watches, | |||
kwargs | |||
) |
def redis.client.StrictRedis.ttl | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.type | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.unwatch | ( | self | ) |
def redis.client.StrictRedis.watch | ( | self, | |
names | |||
) |
def redis.client.StrictRedis.zadd | ( | self, | |
name, | |||
args, | |||
kwargs | |||
) |
SORTED SET COMMANDS ####.
Set any number of score, element-name pairs to the key ``name``. Pairs can be specified in two ways: As *args, in the form of: score1, name1, score2, name2, ... or as **kwargs, in the form of: name1=score1, name2=score2, ... The following example would add four values to the 'my-key' key: redis.zadd('my-key', 1.1, 'name1', 2.2, 'name2', name3=3.3, name4=4.4)
Reimplemented in redis.client.Redis.
def redis.client.StrictRedis.zcard | ( | self, | |
name | |||
) |
def redis.client.StrictRedis.zcount | ( | self, | |
name, | |||
min, | |||
max | |||
) |
def redis.client.StrictRedis.zincrby | ( | self, | |
name, | |||
value, | |||
amount = 1 |
|||
) |
def redis.client.StrictRedis.zinterstore | ( | self, | |
dest, | |||
keys, | |||
aggregate = None |
|||
) |
def redis.client.StrictRedis.zrange | ( | self, | |
name, | |||
start, | |||
end, | |||
desc = False , |
|||
withscores = False , |
|||
score_cast_func = float |
|||
) |
Return a range of values from sorted set ``name`` between ``start`` and ``end`` sorted in ascending order. ``start`` and ``end`` can be negative, indicating the end of the range. ``desc`` a boolean indicating whether to sort the results descendingly ``withscores`` indicates to return the scores along with the values. The return type is a list of (value, score) pairs ``score_cast_func`` a callable used to cast the score return value
def redis.client.StrictRedis.zrangebyscore | ( | self, | |
name, | |||
min, | |||
max, | |||
start = None , |
|||
num = None , |
|||
withscores = False , |
|||
score_cast_func = float |
|||
) |
Return a range of values from the sorted set ``name`` with scores between ``min`` and ``max``. If ``start`` and ``num`` are specified, then return a slice of the range. ``withscores`` indicates to return the scores along with the values. The return type is a list of (value, score) pairs `score_cast_func`` a callable used to cast the score return value
def redis.client.StrictRedis.zrank | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.zrem | ( | self, | |
name, | |||
values | |||
) |
def redis.client.StrictRedis.zremrangebyrank | ( | self, | |
name, | |||
min, | |||
max | |||
) |
def redis.client.StrictRedis.zremrangebyscore | ( | self, | |
name, | |||
min, | |||
max | |||
) |
def redis.client.StrictRedis.zrevrange | ( | self, | |
name, | |||
start, | |||
num, | |||
withscores = False , |
|||
score_cast_func = float |
|||
) |
Return a range of values from sorted set ``name`` between ``start`` and ``num`` sorted in descending order. ``start`` and ``num`` can be negative, indicating the end of the range. ``withscores`` indicates to return the scores along with the values The return type is a list of (value, score) pairs ``score_cast_func`` a callable used to cast the score return value
def redis.client.StrictRedis.zrevrangebyscore | ( | self, | |
name, | |||
max, | |||
min, | |||
start = None , |
|||
num = None , |
|||
withscores = False , |
|||
score_cast_func = float |
|||
) |
Return a range of values from the sorted set ``name`` with scores between ``min`` and ``max`` in descending order. If ``start`` and ``num`` are specified, then return a slice of the range. ``withscores`` indicates to return the scores along with the values. The return type is a list of (value, score) pairs ``score_cast_func`` a callable used to cast the score return value
def redis.client.StrictRedis.zrevrank | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.zscore | ( | self, | |
name, | |||
value | |||
) |
def redis.client.StrictRedis.zunionstore | ( | self, | |
dest, | |||
keys, | |||
aggregate = None |
|||
) |
redis::client.StrictRedis::__contains__ = exists [static, private] |
redis::client.StrictRedis::__delitem__ = delete [static, private] |
redis::client.StrictRedis::__setitem__ = set [static, private] |
tuple redis::client.StrictRedis::RESPONSE_CALLBACKS [static] |
Reimplemented in redis.client.Redis.