desc
stringlengths 3
26.7k
| decl
stringlengths 11
7.89k
| bodies
stringlengths 8
553k
|
---|---|---|
'Flag the ``offset`` in ``name`` as ``value``. Returns a boolean
indicating the previous value of ``offset``.'
| def setbit(self, name, offset, value):
| value = ((value and 1) or 0)
return self.execute_command('SETBIT', name, offset, 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.'
| def setex(self, name, time, value):
| if isinstance(time, datetime.timedelta):
time = (time.seconds + ((time.days * 24) * 3600))
return self.execute_command('SETEX', name, time, value)
|
'Set the value of key ``name`` to ``value`` if key doesn\'t exist'
| def setnx(self, name, value):
| return self.execute_command('SETNX', name, 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 setrange(self, name, offset, value):
| return self.execute_command('SETRANGE', name, offset, value)
|
'Return the number of bytes stored in the value of ``name``'
| def strlen(self, name):
| return self.execute_command('STRLEN', name)
|
'Return a substring of the string at key ``name``. ``start`` and ``end``
are 0-based integers specifying the portion of the string to return.'
| def substr(self, name, start, end=(-1)):
| return self.execute_command('SUBSTR', name, start, end)
|
'Alters the last access time of a key(s) ``*args``. A key is ignored
if it does not exist.'
| def touch(self, *args):
| return self.execute_command('TOUCH', *args)
|
'Returns the number of seconds until the key ``name`` will expire'
| def ttl(self, name):
| return self.execute_command('TTL', name)
|
'Returns the type of key ``name``'
| def type(self, name):
| return self.execute_command('TYPE', name)
|
'Watches the values at keys ``names``, or None if the key doesn\'t exist'
| def watch(self, *names):
| warnings.warn(DeprecationWarning('Call WATCH from a Pipeline object'))
|
'Unwatches the value at key ``name``, or None of the key doesn\'t exist'
| def unwatch(self):
| warnings.warn(DeprecationWarning('Call UNWATCH from a Pipeline object'))
|
'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 blpop(self, keys, timeout=0):
| if (timeout is None):
timeout = 0
if isinstance(keys, basestring):
keys = [keys]
else:
keys = list(keys)
keys.append(timeout)
return self.execute_command('BLPOP', *keys)
|
'RPOP 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 RPOP, 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 brpop(self, keys, timeout=0):
| if (timeout is None):
timeout = 0
if isinstance(keys, basestring):
keys = [keys]
else:
keys = list(keys)
keys.append(timeout)
return self.execute_command('BRPOP', *keys)
|
'Pop a value off the tail of ``src``, push it on the head of ``dst``
and then return it.
This command blocks until a value is in ``src`` or until ``timeout``
seconds elapse, whichever is first. A ``timeout`` value of 0 blocks
forever.'
| def brpoplpush(self, src, dst, timeout=0):
| if (timeout is None):
timeout = 0
return self.execute_command('BRPOPLPUSH', src, dst, timeout)
|
'Return the item from list ``name`` at position ``index``
Negative indexes are supported and will return an item at the
end of the list'
| def lindex(self, name, index):
| return self.execute_command('LINDEX', name, index)
|
'Insert ``value`` in list ``name`` either immediately before or after
[``where``] ``refvalue``
Returns the new length of the list on success or -1 if ``refvalue``
is not in the list.'
| def linsert(self, name, where, refvalue, value):
| return self.execute_command('LINSERT', name, where, refvalue, value)
|
'Return the length of the list ``name``'
| def llen(self, name):
| return self.execute_command('LLEN', name)
|
'Remove and return the first item of the list ``name``'
| def lpop(self, name):
| return self.execute_command('LPOP', name)
|
'Push ``values`` onto the head of the list ``name``'
| def lpush(self, name, *values):
| return self.execute_command('LPUSH', name, *values)
|
'Push ``value`` onto the head of the list ``name`` if ``name`` exists'
| def lpushx(self, name, value):
| return self.execute_command('LPUSHX', name, value)
|
'Return a slice of the list ``name`` between
position ``start`` and ``end``
``start`` and ``end`` can be negative numbers just like
Python slicing notation'
| def lrange(self, name, start, end):
| return self.execute_command('LRANGE', name, start, end)
|
'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.'
| def lrem(self, name, count, value):
| return self.execute_command('LREM', name, count, value)
|
'Set ``position`` of list ``name`` to ``value``'
| def lset(self, name, index, value):
| return self.execute_command('LSET', name, index, value)
|
'Trim the list ``name``, removing all values not within the slice
between ``start`` and ``end``
``start`` and ``end`` can be negative numbers just like
Python slicing notation'
| def ltrim(self, name, start, end):
| return self.execute_command('LTRIM', name, start, end)
|
'Remove and return the last item of the list ``name``'
| def rpop(self, name):
| return self.execute_command('RPOP', name)
|
'RPOP a value off of the ``src`` list and atomically LPUSH it
on to the ``dst`` list. Returns the value.'
| def rpoplpush(self, src, dst):
| return self.execute_command('RPOPLPUSH', src, dst)
|
'Push ``values`` onto the tail of the list ``name``'
| def rpush(self, name, *values):
| return self.execute_command('RPUSH', name, *values)
|
'Push ``value`` onto the tail of the list ``name`` if ``name`` exists'
| def rpushx(self, name, value):
| return self.execute_command('RPUSHX', name, value)
|
'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``
``groups`` if set to True and if ``get`` contains at least two
elements, sort will return a list of tuples, each containing the
values fetched from the arguments to ``get``.'
| def sort(self, name, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False):
| if (((start is not None) and (num is None)) or ((num is not None) and (start is None))):
raise RedisError('``start`` and ``num`` must both be specified')
pieces = [name]
if (by is not None):
pieces.append(Token.get_token('BY'))
pieces.append(by)
if ((start is not None) and (num is not None)):
pieces.append(Token.get_token('LIMIT'))
pieces.append(start)
pieces.append(num)
if (get is not None):
if isinstance(get, basestring):
pieces.append(Token.get_token('GET'))
pieces.append(get)
else:
for g in get:
pieces.append(Token.get_token('GET'))
pieces.append(g)
if desc:
pieces.append(Token.get_token('DESC'))
if alpha:
pieces.append(Token.get_token('ALPHA'))
if (store is not None):
pieces.append(Token.get_token('STORE'))
pieces.append(store)
if groups:
if ((not get) or isinstance(get, basestring) or (len(get) < 2)):
raise DataError('when using "groups" the "get" argument must be specified and contain at least two keys')
options = {'groups': (len(get) if groups else None)}
return self.execute_command('SORT', *pieces, **options)
|
'Incrementally return lists of key names. Also return a cursor
indicating the scan position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns'
| def scan(self, cursor=0, match=None, count=None):
| pieces = [cursor]
if (match is not None):
pieces.extend([Token.get_token('MATCH'), match])
if (count is not None):
pieces.extend([Token.get_token('COUNT'), count])
return self.execute_command('SCAN', *pieces)
|
'Make an iterator using the SCAN command so that the client doesn\'t
need to remember the cursor position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns'
| def scan_iter(self, match=None, count=None):
| cursor = '0'
while (cursor != 0):
(cursor, data) = self.scan(cursor=cursor, match=match, count=count)
for item in data:
(yield item)
|
'Incrementally return lists of elements in a set. Also return a cursor
indicating the scan position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns'
| def sscan(self, name, cursor=0, match=None, count=None):
| pieces = [name, cursor]
if (match is not None):
pieces.extend([Token.get_token('MATCH'), match])
if (count is not None):
pieces.extend([Token.get_token('COUNT'), count])
return self.execute_command('SSCAN', *pieces)
|
'Make an iterator using the SSCAN command so that the client doesn\'t
need to remember the cursor position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns'
| def sscan_iter(self, name, match=None, count=None):
| cursor = '0'
while (cursor != 0):
(cursor, data) = self.sscan(name, cursor=cursor, match=match, count=count)
for item in data:
(yield item)
|
'Incrementally return key/value slices in a hash. Also return a cursor
indicating the scan position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns'
| def hscan(self, name, cursor=0, match=None, count=None):
| pieces = [name, cursor]
if (match is not None):
pieces.extend([Token.get_token('MATCH'), match])
if (count is not None):
pieces.extend([Token.get_token('COUNT'), count])
return self.execute_command('HSCAN', *pieces)
|
'Make an iterator using the HSCAN command so that the client doesn\'t
need to remember the cursor position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns'
| def hscan_iter(self, name, match=None, count=None):
| cursor = '0'
while (cursor != 0):
(cursor, data) = self.hscan(name, cursor=cursor, match=match, count=count)
for item in data.items():
(yield item)
|
'Incrementally return lists of elements in a sorted set. Also return a
cursor indicating the scan position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns
``score_cast_func`` a callable used to cast the score return value'
| def zscan(self, name, cursor=0, match=None, count=None, score_cast_func=float):
| pieces = [name, cursor]
if (match is not None):
pieces.extend([Token.get_token('MATCH'), match])
if (count is not None):
pieces.extend([Token.get_token('COUNT'), count])
options = {'score_cast_func': score_cast_func}
return self.execute_command('ZSCAN', *pieces, **options)
|
'Make an iterator using the ZSCAN command so that the client doesn\'t
need to remember the cursor position.
``match`` allows for filtering the keys by pattern
``count`` allows for hint the minimum number of returns
``score_cast_func`` a callable used to cast the score return value'
| def zscan_iter(self, name, match=None, count=None, score_cast_func=float):
| cursor = '0'
while (cursor != 0):
(cursor, data) = self.zscan(name, cursor=cursor, match=match, count=count, score_cast_func=score_cast_func)
for item in data:
(yield item)
|
'Add ``value(s)`` to set ``name``'
| def sadd(self, name, *values):
| return self.execute_command('SADD', name, *values)
|
'Return the number of elements in set ``name``'
| def scard(self, name):
| return self.execute_command('SCARD', name)
|
'Return the difference of sets specified by ``keys``'
| def sdiff(self, keys, *args):
| args = list_or_args(keys, args)
return self.execute_command('SDIFF', *args)
|
'Store the difference of sets specified by ``keys`` into a new
set named ``dest``. Returns the number of keys in the new set.'
| def sdiffstore(self, dest, keys, *args):
| args = list_or_args(keys, args)
return self.execute_command('SDIFFSTORE', dest, *args)
|
'Return the intersection of sets specified by ``keys``'
| def sinter(self, keys, *args):
| args = list_or_args(keys, args)
return self.execute_command('SINTER', *args)
|
'Store the intersection of sets specified by ``keys`` into a new
set named ``dest``. Returns the number of keys in the new set.'
| def sinterstore(self, dest, keys, *args):
| args = list_or_args(keys, args)
return self.execute_command('SINTERSTORE', dest, *args)
|
'Return a boolean indicating if ``value`` is a member of set ``name``'
| def sismember(self, name, value):
| return self.execute_command('SISMEMBER', name, value)
|
'Return all members of the set ``name``'
| def smembers(self, name):
| return self.execute_command('SMEMBERS', name)
|
'Move ``value`` from set ``src`` to set ``dst`` atomically'
| def smove(self, src, dst, value):
| return self.execute_command('SMOVE', src, dst, value)
|
'Remove and return a random member of set ``name``'
| def spop(self, name):
| return self.execute_command('SPOP', name)
|
'If ``number`` is None, returns a random member of set ``name``.
If ``number`` is supplied, returns a list of ``number`` random
memebers of set ``name``. Note this is only available when running
Redis 2.6+.'
| def srandmember(self, name, number=None):
| args = (((number is not None) and [number]) or [])
return self.execute_command('SRANDMEMBER', name, *args)
|
'Remove ``values`` from set ``name``'
| def srem(self, name, *values):
| return self.execute_command('SREM', name, *values)
|
'Return the union of sets specified by ``keys``'
| def sunion(self, keys, *args):
| args = list_or_args(keys, args)
return self.execute_command('SUNION', *args)
|
'Store the union of sets specified by ``keys`` into a new
set named ``dest``. Returns the number of keys in the new set.'
| def sunionstore(self, dest, keys, *args):
| args = list_or_args(keys, args)
return self.execute_command('SUNIONSTORE', dest, *args)
|
'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)'
| def zadd(self, name, *args, **kwargs):
| pieces = []
if args:
if ((len(args) % 2) != 0):
raise RedisError('ZADD requires an equal number of values and scores')
pieces.extend(args)
for pair in iteritems(kwargs):
pieces.append(pair[1])
pieces.append(pair[0])
return self.execute_command('ZADD', name, *pieces)
|
'Return the number of elements in the sorted set ``name``'
| def zcard(self, name):
| return self.execute_command('ZCARD', name)
|
'Returns the number of elements in the sorted set at key ``name`` with
a score between ``min`` and ``max``.'
| def zcount(self, name, min, max):
| return self.execute_command('ZCOUNT', name, min, max)
|
'Increment the score of ``value`` in sorted set ``name`` by ``amount``'
| def zincrby(self, name, value, amount=1):
| return self.execute_command('ZINCRBY', name, amount, value)
|
'Intersect multiple sorted sets specified by ``keys`` into
a new sorted set, ``dest``. Scores in the destination will be
aggregated based on the ``aggregate``, or SUM if none is provided.'
| def zinterstore(self, dest, keys, aggregate=None):
| return self._zaggregate('ZINTERSTORE', dest, keys, aggregate)
|
'Return the number of items in the sorted set ``name`` between the
lexicographical range ``min`` and ``max``.'
| def zlexcount(self, name, min, max):
| return self.execute_command('ZLEXCOUNT', name, min, max)
|
'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 zrange(self, name, start, end, desc=False, withscores=False, score_cast_func=float):
| if desc:
return self.zrevrange(name, start, end, withscores, score_cast_func)
pieces = ['ZRANGE', name, start, end]
if withscores:
pieces.append(Token.get_token('WITHSCORES'))
options = {'withscores': withscores, 'score_cast_func': score_cast_func}
return self.execute_command(*pieces, **options)
|
'Return the lexicographical range of values from sorted set ``name``
between ``min`` and ``max``.
If ``start`` and ``num`` are specified, then return a slice of the
range.'
| def zrangebylex(self, name, min, max, start=None, num=None):
| if (((start is not None) and (num is None)) or ((num is not None) and (start is None))):
raise RedisError('``start`` and ``num`` must both be specified')
pieces = ['ZRANGEBYLEX', name, min, max]
if ((start is not None) and (num is not None)):
pieces.extend([Token.get_token('LIMIT'), start, num])
return self.execute_command(*pieces)
|
'Return the reversed lexicographical range of values from sorted set
``name`` between ``max`` and ``min``.
If ``start`` and ``num`` are specified, then return a slice of the
range.'
| def zrevrangebylex(self, name, max, min, start=None, num=None):
| if (((start is not None) and (num is None)) or ((num is not None) and (start is None))):
raise RedisError('``start`` and ``num`` must both be specified')
pieces = ['ZREVRANGEBYLEX', name, max, min]
if ((start is not None) and (num is not None)):
pieces.extend([Token.get_token('LIMIT'), start, num])
return self.execute_command(*pieces)
|
'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 zrangebyscore(self, name, min, max, start=None, num=None, withscores=False, score_cast_func=float):
| if (((start is not None) and (num is None)) or ((num is not None) and (start is None))):
raise RedisError('``start`` and ``num`` must both be specified')
pieces = ['ZRANGEBYSCORE', name, min, max]
if ((start is not None) and (num is not None)):
pieces.extend([Token.get_token('LIMIT'), start, num])
if withscores:
pieces.append(Token.get_token('WITHSCORES'))
options = {'withscores': withscores, 'score_cast_func': score_cast_func}
return self.execute_command(*pieces, **options)
|
'Returns a 0-based value indicating the rank of ``value`` in sorted set
``name``'
| def zrank(self, name, value):
| return self.execute_command('ZRANK', name, value)
|
'Remove member ``values`` from sorted set ``name``'
| def zrem(self, name, *values):
| return self.execute_command('ZREM', name, *values)
|
'Remove all elements in the sorted set ``name`` between the
lexicographical range specified by ``min`` and ``max``.
Returns the number of elements removed.'
| def zremrangebylex(self, name, min, max):
| return self.execute_command('ZREMRANGEBYLEX', name, min, max)
|
'Remove all elements in the sorted set ``name`` with ranks between
``min`` and ``max``. Values are 0-based, ordered from smallest score
to largest. Values can be negative indicating the highest scores.
Returns the number of elements removed'
| def zremrangebyrank(self, name, min, max):
| return self.execute_command('ZREMRANGEBYRANK', name, min, max)
|
'Remove all elements in the sorted set ``name`` with scores
between ``min`` and ``max``. Returns the number of elements removed.'
| def zremrangebyscore(self, name, min, max):
| return self.execute_command('ZREMRANGEBYSCORE', name, min, max)
|
'Return a range of values from sorted set ``name`` between
``start`` and ``end`` sorted in descending order.
``start`` and ``end`` 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 zrevrange(self, name, start, end, withscores=False, score_cast_func=float):
| pieces = ['ZREVRANGE', name, start, end]
if withscores:
pieces.append(Token.get_token('WITHSCORES'))
options = {'withscores': withscores, 'score_cast_func': score_cast_func}
return self.execute_command(*pieces, **options)
|
'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 zrevrangebyscore(self, name, max, min, start=None, num=None, withscores=False, score_cast_func=float):
| if (((start is not None) and (num is None)) or ((num is not None) and (start is None))):
raise RedisError('``start`` and ``num`` must both be specified')
pieces = ['ZREVRANGEBYSCORE', name, max, min]
if ((start is not None) and (num is not None)):
pieces.extend([Token.get_token('LIMIT'), start, num])
if withscores:
pieces.append(Token.get_token('WITHSCORES'))
options = {'withscores': withscores, 'score_cast_func': score_cast_func}
return self.execute_command(*pieces, **options)
|
'Returns a 0-based value indicating the descending rank of
``value`` in sorted set ``name``'
| def zrevrank(self, name, value):
| return self.execute_command('ZREVRANK', name, value)
|
'Return the score of element ``value`` in sorted set ``name``'
| def zscore(self, name, value):
| return self.execute_command('ZSCORE', name, value)
|
'Union multiple sorted sets specified by ``keys`` into
a new sorted set, ``dest``. Scores in the destination will be
aggregated based on the ``aggregate``, or SUM if none is provided.'
| def zunionstore(self, dest, keys, aggregate=None):
| return self._zaggregate('ZUNIONSTORE', dest, keys, aggregate)
|
'Adds the specified elements to the specified HyperLogLog.'
| def pfadd(self, name, *values):
| return self.execute_command('PFADD', name, *values)
|
'Return the approximated cardinality of
the set observed by the HyperLogLog at key(s).'
| def pfcount(self, *sources):
| return self.execute_command('PFCOUNT', *sources)
|
'Merge N different HyperLogLogs into a single one.'
| def pfmerge(self, dest, *sources):
| return self.execute_command('PFMERGE', dest, *sources)
|
'Delete ``keys`` from hash ``name``'
| def hdel(self, name, *keys):
| return self.execute_command('HDEL', name, *keys)
|
'Returns a boolean indicating if ``key`` exists within hash ``name``'
| def hexists(self, name, key):
| return self.execute_command('HEXISTS', name, key)
|
'Return the value of ``key`` within the hash ``name``'
| def hget(self, name, key):
| return self.execute_command('HGET', name, key)
|
'Return a Python dict of the hash\'s name/value pairs'
| def hgetall(self, name):
| return self.execute_command('HGETALL', name)
|
'Increment the value of ``key`` in hash ``name`` by ``amount``'
| def hincrby(self, name, key, amount=1):
| return self.execute_command('HINCRBY', name, key, amount)
|
'Increment the value of ``key`` in hash ``name`` by floating ``amount``'
| def hincrbyfloat(self, name, key, amount=1.0):
| return self.execute_command('HINCRBYFLOAT', name, key, amount)
|
'Return the list of keys within hash ``name``'
| def hkeys(self, name):
| return self.execute_command('HKEYS', name)
|
'Return the number of elements in hash ``name``'
| def hlen(self, name):
| return self.execute_command('HLEN', name)
|
'Set ``key`` to ``value`` within hash ``name``
Returns 1 if HSET created a new field, otherwise 0'
| def hset(self, name, key, value):
| return self.execute_command('HSET', name, key, value)
|
'Set ``key`` to ``value`` within hash ``name`` if ``key`` does not
exist. Returns 1 if HSETNX created a field, otherwise 0.'
| def hsetnx(self, name, key, value):
| return self.execute_command('HSETNX', name, key, value)
|
'Set key to value within hash ``name`` for each corresponding
key and value from the ``mapping`` dict.'
| def hmset(self, name, mapping):
| if (not mapping):
raise DataError("'hmset' with 'mapping' of length 0")
items = []
for pair in iteritems(mapping):
items.extend(pair)
return self.execute_command('HMSET', name, *items)
|
'Returns a list of values ordered identically to ``keys``'
| def hmget(self, name, keys, *args):
| args = list_or_args(keys, args)
return self.execute_command('HMGET', name, *args)
|
'Return the list of values within hash ``name``'
| def hvals(self, name):
| return self.execute_command('HVALS', name)
|
'Return the number of bytes stored in the value of ``key``
within hash ``name``'
| def hstrlen(self, name, key):
| return self.execute_command('HSTRLEN', name, key)
|
'Publish ``message`` on ``channel``.
Returns the number of subscribers the message was delivered to.'
| def publish(self, channel, message):
| return self.execute_command('PUBLISH', channel, message)
|
'Return a list of channels that have at least one subscriber'
| def pubsub_channels(self, pattern='*'):
| return self.execute_command('PUBSUB CHANNELS', pattern)
|
'Returns the number of subscriptions to patterns'
| def pubsub_numpat(self):
| return self.execute_command('PUBSUB NUMPAT')
|
'Return a list of (channel, number of subscribers) tuples
for each channel given in ``*args``'
| def pubsub_numsub(self, *args):
| return self.execute_command('PUBSUB NUMSUB', *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 eval(self, script, numkeys, *keys_and_args):
| return self.execute_command('EVAL', script, 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 evalsha(self, sha, numkeys, *keys_and_args):
| return self.execute_command('EVALSHA', sha, numkeys, *keys_and_args)
|
'Check if a script exists in the script cache by specifying the SHAs of
each script as ``args``. Returns a list of boolean values indicating if
if each already script exists in the cache.'
| def script_exists(self, *args):
| return self.execute_command('SCRIPT EXISTS', *args)
|
'Flush all scripts from the script cache'
| def script_flush(self):
| return self.execute_command('SCRIPT FLUSH')
|
'Kill the currently executing Lua script'
| def script_kill(self):
| return self.execute_command('SCRIPT KILL')
|
'Load a Lua ``script`` into the script cache. Returns the SHA.'
| def script_load(self, script):
| return self.execute_command('SCRIPT LOAD', script)
|
'Register a Lua ``script`` specifying the ``keys`` it will touch.
Returns a Script object that is callable and hides the complexity of
deal with scripts, keys, and shas. This is the preferred way to work
with Lua scripts.'
| def register_script(self, script):
| return Script(self, script)
|
'Add the specified geospatial items to the specified key identified
by the ``name`` argument. The Geospatial items are given as ordered
members of the ``values`` argument, each item or place is formed by
the triad longitude, latitude and name.'
| def geoadd(self, name, *values):
| if ((len(values) % 3) != 0):
raise RedisError('GEOADD requires places with lon, lat and name values')
return self.execute_command('GEOADD', name, *values)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.