Appends a value to a key.
Appends a value to a key.
the key to be appended
the value to append
the length of the string after the append operation
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
Counts the number of bits set to 1 in a string from start offset to stop offset.
Counts the number of bits set to 1 in a string from start offset to stop offset.
the key for which the bitcount should be returned
start offset (defaults to 0)
stop offset (defaults to -1)
the number of bits set to 1 in the specified interval
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
Non-existent keys are treated as empty strings, so the command will return zero.
Performs a bitwise operation between multiple strings.
Performs a bitwise operation between multiple strings.
scredis.BitOp to perform
destination key where the result of the operation will be stored
keys to perform the operation upon
the size of the string stored in the destination key, that is equal to the size of the longest input string
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if at least one of the values stored at keys is not of type string
When an operation is performed between strings having different lengths, all the strings shorter than the longest string in the set are treated as if they were zero-padded up to the length of the longest string. The same holds true for non-existent keys, that are considered as a stream of zero bytes up to the length of the longest string.
Return the position of the first bit set to 1 or 0 in a string.
Return the position of the first bit set to 1 or 0 in a string.
string key
provide true to look for 1s and false to look for 0s
start offset, in bytes
stop offset, in bytes
the position of the first bit set to 1 or 0, according to the request
2.8.7
[[scredis.exceptions.RedisErrorResponseException]]
if key is not of type string
The position is returned thinking at the string as an array of bits from left to right where the first byte most significant bit is at position 0, the second byte most significant big is at position 8 and so forth. The range is interpreted as a range of bytes and not a range of bits, so start=0 and end=2 means to look at the first three bytes. If we look for set bits (the bit argument is 1) and the string is empty or composed of just zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string only contains bit set to 1, the function returns the first bit not part of the string on the right. So if the string is tree bytes set to the value 0xff the command BITPOS key 0 will return 24, since up to bit 23 all the bits are 1. Basically the function consider the right of the string as padded with zeros if you look for clear bits and specify no range or the start argument only. However this behavior changes if you are looking for clear bits and specify a range with both start and stop. If no clear bit is found in the specified range, the function returns -1 as the user specified a clear range and there are no 0 bits in that range.
Decrements the integer value of a key by one.
Decrements the integer value of a key by one.
the key to decrement
the value of key after the decrement
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains a string that cannot be
represented as integer
If the key does not exist, it is set to 0 before performing the operation.
Decrements the integer value of a key by the given amount.
Decrements the integer value of a key by the given amount.
the key to decrement
the decrement
the value of key after the decrement
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains
a string that cannot be represented as integer
If the key does not exist, it is set to 0 before performing the operation.
Returns the value stored at key.
Returns the value stored at key.
the target key
value stored at key, or None
if the key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
Returns the bit value at offset in the string value stored at key.
Returns the bit value at offset in the string value stored at key.
the target key
the position in the string
true if the bit is set to 1, false otherwise
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
Returns a substring of the string stored at a key.
Returns a substring of the string stored at a key.
the target key
the start offset (inclusive)
the stop offset (inclusive)
the substring determined by the specified offsets, or the empty string if the key does not exist
2.4.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
Both offsets are inclusive, i.e. [start, stop]. The function handles out of range requests by limiting the resulting range to the actual length of the string.
Sets the string value of a key and return its old value.
Sets the string value of a key and return its old value.
the target key
the value to set key to
the old value, or None
if the latter did not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
Increments the integer value of a key by one.
Increments the integer value of a key by one.
the key to increment
the value of key after the increment
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains a string that cannot be
represented as integer
If the key does not exist, it is set to 0 before performing the operation.
Increments the integer value of a key by the given amount.
Increments the integer value of a key by the given amount.
the key to increment
the increment
the value of key after the decrement
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains
a string that cannot be represented as integer
If the key does not exist, it is set to 0 before performing the operation.
Increment the float value of a key by the given amount.
Increment the float value of a key by the given amount.
the key to increment
the increment
the value of key after the decrement
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type, the current key content or the
specified increment are not parseable as a double precision floating point number
If the key does not exist, it is set to 0 before performing the operation.
Returns the values of all specified keys.
Returns the values of all specified keys.
the keys to fetch
list of value(s) stored at the specified key(s)
1.0.0
For every key that does not hold a string value or does not exist, None
is returned.
Because of this, the operation never fails.
Returns a Map
containing the specified key(s) paired to their respective value(s).
Returns a Map
containing the specified key(s) paired to their respective value(s).
the keys to fetch
map of key-value pairs
1.0.0
Every key that does not hold a string value or does not exist will be removed from the
resulting Map
.
Atomically sets multiple keys to multiple values.
Atomically sets multiple keys to multiple values.
map of key-value pairs to set
1.0.1
MSET replaces existing values with new values, just as regular SET.
Atomically sets multiple keys to multiple values, only if none of the keys exist.
Atomically sets multiple keys to multiple values, only if none of the keys exist.
map of key-value pairs to set
true if all the keys were set, false if at least one key already existed and thus no operation was performed.
1.0.1
MSETNX will not perform any operation at all even if just a single key already exists.
Sets the value and expiration in milliseconds of a key.
Sets the value and expiration in milliseconds of a key.
target key to set
value to be stored at key
time-to-live in milliseconds
2.6.0
If key already holds a value, it is overwritten, regardless of its type.
Sets the string value of a key.
Sets the string value of a key.
target key to set
value to be stored at key
optional time-to-live (up to milliseconds precision)
optional condition to be met for the value to be set
true if the value was set correctly, false if a condition was specified but not met
1.0.0
If key already holds a value, it is overwritten, regardless of its type. Any previous
time to live associated with the key is discarded on successful SET operation.
The ttlOpt and conditionOpt parameters can only be used with Redis
>= 2.6.12
Sets or clears the bit at offset in the string value stored at key.
Sets or clears the bit at offset in the string value stored at key.
key for which the bit should be set
position where the bit should be set
true sets the bit to 1, false sets it to 0
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type
When key does not exist, a new string value is created. The string is grown to make sure it can hold a bit at offset. When the string at key is grown, added bits are set to 0.
Sets the value and expiration in seconds of a key.
Sets the value and expiration in seconds of a key.
target key to set
value to be stored at key
time-to-live in seconds
2.0.0
If key already holds a value, it is overwritten, regardless of its type.
Sets the value of a key, only if the key does not exist.
Sets the value of a key, only if the key does not exist.
target key to set
value to be stored at key
true if the key was set, false otherwise
1.0.0
Overwrites part of a string at key starting at the specified offset.
Overwrites part of a string at key starting at the specified offset.
target key
position from which the string must be overwritten
string value to be set at given offset
the length of the string after it was modified by the command
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type
If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset.
Returns the length of the string value stored in a key.
Returns the length of the string value stored in a key.
target key
the length of the string stored at key, or 0 when the key does not exist
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type
This trait implements string commands.