Package redis :: Module client :: Class StrictRedis
[frames] | no frames]

Class StrictRedis

source code

object --+
         |
        StrictRedis
Known Subclasses:

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

Instance Methods
 
__init__(self, host='localhost', port=6379, db=0, password=None, socket_timeout=None, connection_pool=None, charset='utf-8', errors='strict', decode_responses=False, unix_socket_path=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
set_response_callback(self, command, callback)
Set a custom Response Callback
source code
 
pipeline(self, transaction=True, shard_hint=None)
Return a new pipeline object that can queue multiple commands for later execution.
source code
 
transaction(self, func, *watches, **kwargs)
Convenience method for executing the callable `func` as a transaction while watching all keys specified in `watches`.
source code
 
lock(self, name, timeout=None, sleep=0.1)
Return a new Lock object using key ``name`` that mimics the behavior of threading.Lock.
source code
 
pubsub(self, shard_hint=None)
Return a Publish/Subscribe object.
source code
 
execute_command(self, *args, **options)
Execute a command and return a parsed response
source code
 
parse_response(self, connection, command_name, **options)
Parses a response from the Redis server
source code
 
bgrewriteaof(self)
Tell the Redis server to rewrite the AOF file from data in memory.
source code
 
bgsave(self)
Tell the Redis server to save its data to disk.
source code
 
config_get(self, pattern='*')
Return a dictionary of configuration based on the ``pattern``
source code
 
config_set(self, name, value)
Set config item ``name`` with ``value``
source code
 
dbsize(self)
Returns the number of keys in the current database
source code
 
time(self)
Returns the server time as a 2-item tuple of ints: (seconds since epoch, microseconds into this second).
source code
 
debug_object(self, key)
Returns version specific metainformation about a give key
source code
 
delete(self, *names)
Delete one or more keys specified by ``names``
source code
 
__delitem__(self, *names)
Delete one or more keys specified by ``names``
source code
 
echo(self, value)
Echo the string back from the server
source code
 
flushall(self)
Delete all keys in all databases on the current host
source code
 
flushdb(self)
Delete all keys in the current database
source code
 
info(self)
Returns a dictionary containing information about the Redis server
source code
 
lastsave(self)
Return a Python datetime object representing the last time the Redis database was saved to disk
source code
 
object(self, infotype, key)
Return the encoding, idletime, or refcount about the key
source code
 
ping(self)
Ping the Redis server
source code
 
save(self)
Tell the Redis server to save its data to disk, blocking until the save is complete
source code
 
shutdown(self)
Shutdown the server
source code
 
slaveof(self, host=None, port=None)
Set the server to be a replicated slave of the instance identified by the ``host`` and ``port``.
source code
 
append(self, key, value)
Appends the string ``value`` to the value at ``key``.
source code
 
getrange(self, key, start, end)
Returns the substring of the string value stored at ``key``, determined by the offsets ``start`` and ``end`` (both are inclusive)
source code
 
bitcount(self, key, start=None, end=None)
Returns the count of set bits in the value of ``key``.
source code
 
bitop(self, operation, dest, *keys)
Perform a bitwise operation using ``operation`` between ``keys`` and store the result in ``dest``.
source code
 
decr(self, name, amount=1)
Decrements the value of ``key`` by ``amount``.
source code
 
exists(self, name)
Returns a boolean indicating whether key ``name`` exists
source code
 
__contains__(self, name)
Returns a boolean indicating whether key ``name`` exists
source code
 
expire(self, name, time)
Set an expire flag on key ``name`` for ``time`` seconds.
source code
 
expireat(self, name, when)
Set an expire flag on key ``name``.
source code
 
get(self, name)
Return the value at key ``name``, or None if the key doesn't exist
source code
 
__getitem__(self, name)
Return the value at key ``name``, raises a KeyError if the key doesn't exist.
source code
 
getbit(self, name, offset)
Returns a boolean indicating the value of ``offset`` in ``name``
source code
 
getset(self, name, value)
Set the value at key ``name`` to ``value`` if key doesn't exist Return the value at key ``name`` atomically
source code
 
incr(self, name, amount=1)
Increments the value of ``key`` by ``amount``.
source code
 
keys(self, pattern='*')
Returns a list of keys matching ``pattern``
source code
 
mget(self, keys, *args)
Returns a list of values ordered identically to ``keys``
source code
 
mset(self, mapping)
Sets each key in the ``mapping`` dict to its corresponding value
source code
 
msetnx(self, mapping)
Sets each key in the ``mapping`` dict to its corresponding value if none of the keys are already set
source code
 
move(self, name, db)
Moves the key ``name`` to a different Redis database ``db``
source code
 
persist(self, name)
Removes an expiration on ``name``
source code
 
randomkey(self)
Returns the name of a random key
source code
 
rename(self, src, dst)
Rename key ``src`` to ``dst``
source code
 
renamenx(self, src, dst)
Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist
source code
 
set(self, name, value)
Set the value at key ``name`` to ``value``
source code
 
__setitem__(self, name, value)
Set the value at key ``name`` to ``value``
source code
 
setbit(self, name, offset, value)
Flag the ``offset`` in ``name`` as ``value``.
source code
 
setex(self, name, time, value)
Set the value of key ``name`` to ``value`` that expires in ``time`` seconds.
source code
 
setnx(self, name, value)
Set the value of key ``name`` to ``value`` if key doesn't exist
source code
 
setrange(self, name, offset, value)
Overwrite bytes in the value of ``name`` starting at ``offset`` with ``value``.
source code
 
strlen(self, name)
Return the number of bytes stored in the value of ``name``
source code
 
substr(self, name, start, end=-1)
Return a substring of the string at key ``name``.
source code
 
ttl(self, name)
Returns the number of seconds until the key ``name`` will expire
source code
 
type(self, name)
Returns the type of key ``name``
source code
 
watch(self, *names)
Watches the values at keys ``names``, or None if the key doesn't exist
source code
 
unwatch(self)
Unwatches the value at key ``name``, or None of the key doesn't exist
source code
 
blpop(self, keys, timeout=0)
LPOP a value off of the first non-empty list named in the ``keys`` list.
source code
 
brpop(self, keys, timeout=0)
RPOP a value off of the first non-empty list named in the ``keys`` list.
source code
 
brpoplpush(self, src, dst, timeout=0)
Pop a value off the tail of ``src``, push it on the head of ``dst`` and then return it.
source code
 
lindex(self, name, index)
Return the item from list ``name`` at position ``index``
source code
 
linsert(self, name, where, refvalue, value)
Insert ``value`` in list ``name`` either immediately before or after [``where``] ``refvalue``
source code
 
llen(self, name)
Return the length of the list ``name``
source code
 
lpop(self, name)
Remove and return the first item of the list ``name``
source code
 
lpush(self, name, *values)
Push ``values`` onto the head of the list ``name``
source code
 
lpushx(self, name, value)
Push ``value`` onto the head of the list ``name`` if ``name`` exists
source code
 
lrange(self, name, start, end)
Return a slice of the list ``name`` between position ``start`` and ``end``
source code
 
lrem(self, name, count, value)
Remove the first ``count`` occurrences of elements equal to ``value`` from the list stored at ``name``.
source code
 
lset(self, name, index, value)
Set ``position`` of list ``name`` to ``value``
source code
 
ltrim(self, name, start, end)
Trim the list ``name``, removing all values not within the slice between ``start`` and ``end``
source code
 
rpop(self, name)
Remove and return the last item of the list ``name``
source code
 
rpoplpush(self, src, dst)
RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list.
source code
 
rpush(self, name, *values)
Push ``values`` onto the tail of the list ``name``
source code
 
rpushx(self, name, value)
Push ``value`` onto the tail of the list ``name`` if ``name`` exists
source code
 
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``.
source code
 
sadd(self, name, *values)
Add ``value(s)`` to set ``name``
source code
 
scard(self, name)
Return the number of elements in set ``name``
source code
 
sdiff(self, keys, *args)
Return the difference of sets specified by ``keys``
source code
 
sdiffstore(self, dest, keys, *args)
Store the difference of sets specified by ``keys`` into a new set named ``dest``.
source code
 
sinter(self, keys, *args)
Return the intersection of sets specified by ``keys``
source code
 
sinterstore(self, dest, keys, *args)
Store the intersection of sets specified by ``keys`` into a new set named ``dest``.
source code
 
sismember(self, name, value)
Return a boolean indicating if ``value`` is a member of set ``name``
source code
 
smembers(self, name)
Return all members of the set ``name``
source code
 
smove(self, src, dst, value)
Move ``value`` from set ``src`` to set ``dst`` atomically
source code
 
spop(self, name)
Remove and return a random member of set ``name``
source code
 
srandmember(self, name)
Return a random member of set ``name``
source code
 
srem(self, name, *values)
Remove ``values`` from set ``name``
source code
 
sunion(self, keys, *args)
Return the union of sets specifiued by ``keys``
source code
 
sunionstore(self, dest, keys, *args)
Store the union of sets specified by ``keys`` into a new set named ``dest``.
source code
 
zadd(self, name, *args, **kwargs)
Set any number of score, element-name pairs to the key ``name``.
source code
 
zcard(self, name)
Return the number of elements in the sorted set ``name``
source code
 
zcount(self, name, min, max) source code
 
zincrby(self, name, value, amount=1)
Increment the score of ``value`` in sorted set ``name`` by ``amount``
source code
 
zinterstore(self, dest, keys, aggregate=None)
Intersect multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``.
source code
 
zrange(self, name, start, end, desc=False, withscores=False, score_cast_func=<type 'float'>)
Return a range of values from sorted set ``name`` between ``start`` and ``end`` sorted in ascending order.
source code
 
zrangebyscore(self, name, min, max, start=None, num=None, withscores=False, score_cast_func=<type 'float'>)
Return a range of values from the sorted set ``name`` with scores between ``min`` and ``max``.
source code
 
zrank(self, name, value)
Returns a 0-based value indicating the rank of ``value`` in sorted set ``name``
source code
 
zrem(self, name, *values)
Remove member ``values`` from sorted set ``name``
source code
 
zremrangebyrank(self, name, min, max)
Remove all elements in the sorted set ``name`` with ranks between ``min`` and ``max``.
source code
 
zremrangebyscore(self, name, min, max)
Remove all elements in the sorted set ``name`` with scores between ``min`` and ``max``.
source code
 
zrevrange(self, name, start, num, withscores=False, score_cast_func=<type 'float'>)
Return a range of values from sorted set ``name`` between ``start`` and ``num`` sorted in descending order.
source code
 
zrevrangebyscore(self, name, max, min, start=None, num=None, withscores=False, score_cast_func=<type 'float'>)
Return a range of values from the sorted set ``name`` with scores between ``min`` and ``max`` in descending order.
source code
 
zrevrank(self, name, value)
Returns a 0-based value indicating the descending rank of ``value`` in sorted set ``name``
source code
 
zscore(self, name, value)
Return the score of element ``value`` in sorted set ``name``
source code
 
zunionstore(self, dest, keys, aggregate=None)
Union multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``.
source code
 
hdel(self, name, *keys)
Delete ``keys`` from hash ``name``
source code
 
hexists(self, name, key)
Returns a boolean indicating if ``key`` exists within hash ``name``
source code
 
hget(self, name, key)
Return the value of ``key`` within the hash ``name``
source code
 
hgetall(self, name)
Return a Python dict of the hash's name/value pairs
source code
 
hincrby(self, name, key, amount=1)
Increment the value of ``key`` in hash ``name`` by ``amount``
source code
 
hkeys(self, name)
Return the list of keys within hash ``name``
source code
 
hlen(self, name)
Return the number of elements in hash ``name``
source code
 
hset(self, name, key, value)
Set ``key`` to ``value`` within hash ``name`` Returns 1 if HSET created a new field, otherwise 0
source code
 
hsetnx(self, name, key, value)
Set ``key`` to ``value`` within hash ``name`` if ``key`` does not exist.
source code
 
hmset(self, name, mapping)
Sets each key in the ``mapping`` dict to its corresponding value in the hash ``name``
source code
 
hmget(self, name, keys, *args)
Returns a list of values ordered identically to ``keys``
source code
 
hvals(self, name)
Return the list of values within hash ``name``
source code
 
publish(self, channel, message)
Publish ``message`` on ``channel``.
source code
 
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``.
source code
 
evalsha(self, sha, numkeys, *keys_and_args)
Use the ``sha`` to execute a LUA script already registered via EVAL or SCRIPT LOAD.
source code
 
script_exists(self, *args)
Check if a script exists in the script cache by specifying the SHAs of each script as ``args``.
source code
 
script_flush(self)
Flush all scripts from the script cache
source code
 
script_kill(self)
Kill the currently executing LUA script
source code
 
script_load(self, script)
Load a LUA ``script`` into the script cache.
source code
 
register_script(self, script)
Register a LUA ``script`` specifying the ``keys`` it will touch.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
from_url(cls, url, db=None, **kwargs)
Return a Redis client object configured from the given URL.
source code
Class Variables
  RESPONSE_CALLBACKS = {'AUTH': <type 'bool'>, 'BGREWRITEAOF': <...
Properties

Inherited from object: __class__

Method Details

from_url(cls, url, db=None, **kwargs)
Class Method

source code 

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.

__init__(self, host='localhost', port=6379, db=0, password=None, socket_timeout=None, connection_pool=None, charset='utf-8', errors='strict', decode_responses=False, unix_socket_path=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

pipeline(self, transaction=True, shard_hint=None)

source code 

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.

transaction(self, func, *watches, **kwargs)

source code 

Convenience method for executing the callable `func` as a transaction while watching all keys specified in `watches`. The 'func' callable should expect a single arguement which is a Pipeline object.

lock(self, name, timeout=None, sleep=0.1)

source code 

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.

pubsub(self, shard_hint=None)

source code 

Return a Publish/Subscribe object. With this object, you can subscribe to channels and listen for messages that get published to them.

bgsave(self)

source code 

Tell the Redis server to save its data to disk. Unlike save(), this method is asynchronous and returns immediately.

slaveof(self, host=None, port=None)

source code 

Set the server to be a replicated slave of the instance identified by the ``host`` and ``port``. If called without arguements, the instance is promoted to a master instead.

append(self, key, value)

source code 

Appends the string ``value`` to the value at ``key``. If ``key`` doesn't already exist, create it with a value of ``value``. Returns the new length of the value at ``key``.

bitcount(self, key, start=None, end=None)

source code 

Returns the count of set bits in the value of ``key``. Optional ``start`` and ``end`` paramaters indicate which bytes to consider

decr(self, name, amount=1)

source code 

Decrements the value of ``key`` by ``amount``. If no key exists, the value will be initialized as 0 - ``amount``

expire(self, name, time)

source code 

Set an expire flag on key ``name`` for ``time`` seconds. ``time`` can be represented by an integer or a Python timedelta object.

expireat(self, name, when)

source code 

Set an expire flag on key ``name``. ``when`` can be represented as an integer indicating unix time or a Python datetime object.

incr(self, name, amount=1)

source code 

Increments the value of ``key`` by ``amount``. If no key exists, the value will be initialized as ``amount``

setbit(self, name, offset, value)

source code 

Flag the ``offset`` in ``name`` as ``value``. Returns a boolean indicating the previous value of ``offset``.

setex(self, name, time, value)

source code 

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.

setrange(self, name, offset, value)

source code 

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.

substr(self, name, start, end=-1)

source code 

Return a substring of the string at key ``name``. ``start`` and ``end`` are 0-based integers specifying the portion of the string to return.

blpop(self, keys, timeout=0)

source code 

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.

brpop(self, keys, timeout=0)

source code 

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 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.

brpoplpush(self, src, dst, timeout=0)

source code 

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.

lindex(self, name, index)

source code 

Return the item from list ``name`` at position ``index``

Negative indexes are supported and will return an item at the end of the list

linsert(self, name, where, refvalue, value)

source code 

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.

lrange(self, name, start, end)

source code 

Return a slice of the list ``name`` between position ``start`` and ``end``

``start`` and ``end`` can be negative numbers just like Python slicing notation

lrem(self, name, count, value)

source code 

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.

ltrim(self, name, start, end)

source code 

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

rpoplpush(self, src, dst)

source code 

RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list. Returns the value.

sort(self, name, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None)

source code 

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``

sdiffstore(self, dest, keys, *args)

source code 

Store the difference of sets specified by ``keys`` into a new set named ``dest``. Returns the number of keys in the new set.

sinterstore(self, dest, keys, *args)

source code 

Store the intersection of sets specified by ``keys`` into a new set named ``dest``. Returns the number of keys in the new set.

sunionstore(self, dest, keys, *args)

source code 

Store the union of sets specified by ``keys`` into a new set named ``dest``. Returns the number of keys in the new set.

zadd(self, name, *args, **kwargs)

source code 

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)

zinterstore(self, dest, keys, aggregate=None)

source code 

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.

zrange(self, name, start, end, desc=False, withscores=False, score_cast_func=<type 'float'>)

source code 

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

zrangebyscore(self, name, min, max, start=None, num=None, withscores=False, score_cast_func=<type 'float'>)

source code 

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

zremrangebyrank(self, name, min, max)

source code 

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

zremrangebyscore(self, name, min, max)

source code 

Remove all elements in the sorted set ``name`` with scores between ``min`` and ``max``. Returns the number of elements removed.

zrevrange(self, name, start, num, withscores=False, score_cast_func=<type 'float'>)

source code 

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

zrevrangebyscore(self, name, max, min, start=None, num=None, withscores=False, score_cast_func=<type 'float'>)

source code 

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

zunionstore(self, dest, keys, aggregate=None)

source code 

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.

hsetnx(self, name, key, value)

source code 

Set ``key`` to ``value`` within hash ``name`` if ``key`` does not exist. Returns 1 if HSETNX created a field, otherwise 0.

publish(self, channel, message)

source code 

Publish ``message`` on ``channel``. Returns the number of subscribers the message was delivered to.

eval(self, script, numkeys, *keys_and_args)

source code 

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.

evalsha(self, sha, numkeys, *keys_and_args)

source code 

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.

script_exists(self, *args)

source code 

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.

script_load(self, script)

source code 

Load a LUA ``script`` into the script cache. Returns the SHA.

register_script(self, script)

source code 

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.


Class Variable Details

RESPONSE_CALLBACKS

Value:
dict_merge(string_keys_to_dict('AUTH DEL EXISTS EXPIRE EXPIREAT HDEL H\
EXISTS HMSET MOVE MSETNX ' 'PERSIST RENAMENX SISMEMBER SMOVE SETEX SET\
NX SREM ZREM', bool), string_keys_to_dict('BITCOUNT DECRBY GETBIT HLEN\
 INCRBY LINSERT LLEN LPUSHX RPUSHX ' 'SADD SCARD SDIFFSTORE SETBIT SET\
RANGE SINTERSTORE STRLEN ' 'SUNIONSTORE ZADD ZCARD ZREMRANGEBYRANK ZRE\
MRANGEBYSCORE', int), string_keys_to_dict('LPUSH RPUSH', lambda r: isi\
nstance(r, long) and r or nativestr(r)== 'OK'), string_keys_to_dict('Z\
SCORE ZINCRBY', float_or_none), string_keys_to_dict('FLUSHALL FLUSHDB \
...