Constructs a scredis.Client instance from a config file and using the provided path.
Constructs a scredis.Client instance from a config file and using the provided path.
config filename
path pointing to the scredis config object
the constructed scredis.Client
The path must include to the scredis object, e.g. x.y.scredis
Constructs a scredis.Client instance from a config file.
Constructs a scredis.Client instance from a config file.
config filename
the constructed scredis.Client
The config file must contain the scredis object at its root. This constructor is equivalent to
new Client(configName, "scredis")
Constructs a scredis.Client instance from a com.typesafe.Config
Constructs a scredis.Client instance from a com.typesafe.Config
com.typesafe.Config
the constructed scredis.Client
The config must contain the scredis object at its root. This constructor is equivalent to
new Client(config, "scredis")
Constructs a scredis.Client instance from a scredis.RedisConfig
Constructs a scredis.Client instance from a scredis.RedisConfig
the constructed scredis.Client
server address
server port
optional server password
database index to select
optional client name (available since 2.6.9)
connection timeout
optional batch receive timeout
max number of bytes to send as part of a batch
size hint of the tcp send buffer, in bytes
size hint of the tcp receive buffer, in bytes
path to listener dispatcher definition
path to io dispatcher definition
path to decoder dispatcher definition
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
Authenticates to the server.
Authenticates to the server.
the server password
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if authentication failed
Use the empty string to re-authenticate with no password.
Waits for all the internal actors to be shutdown.
Waits for all the internal actors to be shutdown.
amount of time to wait
This method is usually called after issuing a QUIT command
Asynchronously rewrites the append-only file.
Asynchronously rewrites the append-only file.
1.0.0
Asynchronously saves the dataset to disk.
Asynchronously saves the dataset to disk.
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the background save is already in progress
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.
Get the current client name.
Get the current client name.
option containing the name if it has been set, None
otherwise
2.6.9
Kills the connection of a client.
Kills the connection of a client.
ip address of the client to kill
port of the client to kill
2.4.0
[[scredis.exceptions.RedisErrorResponseException]]
if the the client does not exist
Kills the connection of potentially multiple clients satisfying various filters.
Kills the connection of potentially multiple clients satisfying various filters.
when true, the calling client will not be killed, when false, the latter can be killed
the number of killed client(s)
2.8.12
Lists all client connections.
Suspends all clients for the specified amount of time.
Suspends all clients for the specified amount of time.
the amount of time in milliseconds for which clients should be suspended
2.9.50
[[scredis.exceptions.RedisErrorResponseException]]
if the timeout is invalid
Sets the current client name.
Sets the current client name. If the empty string is provided, the name will be unset.
name to associate the client to, if empty, unsets the client name
2.6.9
Returns details about all Redis
commands.
Returns details about all Redis
commands.
map of command name to command info
2.8.13
Returns the total number of commands in the target Redis
server.
Returns the total number of commands in the target Redis
server.
total number of commands
2.8.13
Returns the list of keys part of a full Redis
command.
Returns the list of keys part of a full Redis
command.
the list of keys present in the command
2.8.13
Returns details about the specified Redis
commands.
Returns details about the specified Redis
commands.
command names
map of command name to command info
2.8.13
Gets the value of a configuration parameter.
Gets the value of a configuration parameter.
name or pattern of the configuration parameter to get
option containing the matched parameters, or None
if no parameters are matched
2.0.0
Resets the stats returned by INFO.
Resets the stats returned by INFO.
2.0.0
Rewrites the redis.conf file the server was started with, applying the minimal changes needed to make it reflect the configuration currently used by the server, which may be different compared to the original one because of the use of the CONFIG SET command.
Rewrites the redis.conf file the server was started with, applying the minimal changes needed to make it reflect the configuration currently used by the server, which may be different compared to the original one because of the use of the CONFIG SET command.
2.8.0
[[scredis.exceptions.RedisErrorResponseException]]
if the configuration file was not properly written
Sets a configuration parameter to the given value.
Sets a configuration parameter to the given value.
parameter's name
value to set parameter to
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the parameter could not be set
Return the number of keys in the selected database.
Return the number of keys in the selected database.
number of keys in the selected database
1.0.0
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.
Deletes one or multiple keys.
Deletes one or multiple keys.
key(s) to delete
the number of keys that were deleted
1.0.0
a key is ignored if it does not exist
Returns a serialized version of the value stored at the specified key.
Returns a serialized version of the value stored at the specified key.
key to dump
the serialized value or None
if the key does not exist
2.6.0
Echoes the given string on the server.
Echoes the given string on the server.
the message to echo
the echoed message
1.0.0
Executes a Lua script that does not require any keys or arguments.
Executes a Lua script that does not require any keys or arguments.
the LUA script
keys to be used in the script
arguments to be used in the script
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if an error occurs while running the script
[[scredis.exceptions.RedisProtocolException]]
if the result could not be decoded by provided Decoder
Executes a cached Lua script that does not require any keys or arguments by its SHA1 digest.
Executes a cached Lua script that does not require any keys or arguments by its SHA1 digest.
the SHA1 digest
keys to be used in the script
arguments to be used in the script
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if there is no script corresponding to the provided SHA1 digest or if an error
occurs while running the script
[[scredis.exceptions.RedisProtocolException]]
if the result could not be decoded by provided Decoder
Determines if a key exists.
Determines if a key exists.
key to check for existence
true if the key exists, false otherwise
1.0.0
Sets a key's time to live in seconds.
Sets a key's time to live in seconds.
key to expire
time-to-live in seconds
true if the ttl was set, false if key does not exist or the timeout could not be set
1.0.0
Sets the expiration for a key as a UNIX timestamp.
Sets the expiration for a key as a UNIX timestamp.
key to expire
UNIX timestamp at which the key should expire
true if the ttl was set, false if key does not exist or the timeout could not be set
1.2.0
Removes all keys from all databases.
Removes all keys from all databases.
1.0.0
Removes all keys from the current database.
Removes all keys from the current database.
1.0.0
Adds the specified geospatial items (longitude, latitude, name) to the specified key.
Adds the specified geospatial items (longitude, latitude, name) to the specified key. Data is stored into the key as a sorted set, in a way that makes it possible to later retrieve items using a query by radius with the GEORADIUS or GEORADIUSBYMEMBER commands.
The command takes arguments in the standard format x,y so the longitude must be specified before the latitude. There are limits to the coordinates that can be indexed: areas very near to the poles are not indexable. The exact limits, as specified by EPSG:900913 / EPSG:3785 / OSGEO:41001 are the following:
Valid longitudes are from -180 to 180 degrees. Valid latitudes are from -85.05112878 to 85.05112878 degrees.
The command will report an error when the user attempts to index coordinates outside the specified ranges.
Name of a sortedSet to which points will be added
points description consisting of 3 elements (longitude, latitude, name)
The number of elements added to the sorted set, not including elements already existing for which the score was updated.
client.geoAdd("GeoSet", GeoAddEntry(1.11, 2.22, "Paris"), GeoAddEntry(5.55, 6.66, "Berlin"))
3.2.0
scredis.exceptions.RedisErrorResponseException
if coordinates are out of expected range.
Return the distance between two members in the geospatial index represented by the sorted set.
Return the distance between two members in the geospatial index represented by the sorted set.
Given a sorted set representing a geospatial index, populated using the GEOADD command, the command returns the distance between the two specified members in the specified unit.
Units: scredis.protocol.requests.GeoDistUnit
The distance is computed assuming that the Earth is a perfect sphere, so errors up to 0.5% are possible in edge cases.
client.geoAdd("GeoSet", GeoAddEntry(12.123, -3.321, "Chicago"), GeoAddEntry(-11.4, 3.99, "Prague")) client.geoDist("GeoSet", "Chicago", "Prague")
Name of a sortedSet from which members will be used
name present in 'key' set
name present in 'key' set
Measure unit used in response scredis.protocol.requests.GeoDistUnit
distance between two members in a set in specified measure unit or None if any of members not found in a set.
3.2.0
Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
The command returns 11 characters Geohash strings, so no precision is loss compared to the Redis internal 52 bit representation. The returned Geohashes have the following properties:
They can be shortened removing characters from the right. It will lose precision but will still point to the same area. It is possible to use them in geohash.org URLs such as http://geohash.org/<geohash-string>. Strings with a similar prefix are nearby, but the contrary is not true, it is possible that strings with different prefixes are nearby too.
client.geoAdd("GeoSet", GeoAddEntry(1.11, 2.22, "Warsaw")) client.geoHash("GeoSet", "Warsaw", "unknownloc")
Name of a sortedSet from which members will be used
sequence of name entries present in set.
List with calculated geohash corresponding to each present member and None for not found members.
3.2.0
Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
Given a sorted set representing a geospatial index, populated using the GEOADD command, it is often useful to obtain back the coordinates of specified members. When the geospatial index is populated via GEOADD the coordinates are converted into a 52 bit geohash, so the coordinates returned may not be exactly the ones used in order to add the elements, but small errors may be introduced.
client.geoAdd("GeoSet", GeoAddEntry(10, 10, "Paris")) client.geoPos("GeoSet", "Paris", "Unknown")
Name of a sortedSet from which members will be used
sequence of name entries present in set.
list where each entry represents coordinates (longitude, latitude) of corresponding member name or None if member is not found.
3.2.0
Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the maximum distance from the center (the radius).
Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the maximum distance from the center (the radius).
The common use case for this command is to retrieve geospatial items near a specified point not farther than a given amount of meters (or other units). This allows, for example, to suggest mobile users of an application nearby places.
client.geoAdd("GeoSet", GeoAddEntry(1.111, 1.5, "Tokyo"), GeoAddEntry(1.222, 1.6, "Kyoto"), GeoAddEntry(1.5, 1.333, "Nagasaki")) client.geoRadius("GeoSet", 1, 1, 3500, GeoDistUnit.km)
Name of a sortedSet in which points will be searched.
First coordinate of a point.
Second coordinate of a point.
Distance between given point and an edge of a circle. Specified in 'radiusUnit' units.
Units of measure in which radius is expressed scredis.protocol.requests.GeoDistUnit
List of member names from 'key' set.
3.2.0
This command is exactly like GEORADIUS with the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index represented by the sorted set.
This command is exactly like GEORADIUS with the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index represented by the sorted set.
The position of the specified member is used as the center of the query.
Name of a sortedSet in which points will be searched.
Name present in 'key' set
Radius in which returned elements are found. Specified in 'radiusUnit' units.
Units of measure in which radius is expressed scredis.protocol.requests.GeoDistUnit
List of member names from 'key' set.
3.2.0
scredis.exceptions.RedisErrorResponseException
if member is not found in set.
scredis.commands.GeoCommands.geoRadius
client.geoAdd("GeoSet", GeoAddEntry(1.111, 1.5, "Tokyo"), GeoAddEntry(1.222, 1.6, "Kyoto"), GeoAddEntry(1.5, 1.333, "Nagasaki")) client.geoRadiusByMember("GeoSet", "Tokyo", 60000, GeoDistUnit.km)
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
Deletes one or more hash fields.
Deletes one or more hash fields.
key of the hash
field(s) to be deleted from hash
the number of fields that were removed from the hash, not including specified but non existing fields
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Specified fields that do not exist within this hash are ignored. If key does not exist, it is treated as an empty hash and this command returns 0. Redis versions older than 2.4 can only remove a field per call.
Determines if a hash field exists.
Determines if a hash field exists.
hash key
name of the field
true if the hash contains field, false if the hash does not contain it or the key does not exists
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Returns the value of a hash field.
Returns the value of a hash field.
hash key
field name to retrieve
the value associated with field name, or None
when field is not present in the hash
or key does not exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Returns all the fields and values in a hash.
Returns all the fields and values in a hash.
hash key
key-value pairs stored in hash with key, or None
when hash is empty or key does not
exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Increments the integer value of a hash field by the given number.
Increments the integer value of a hash field by the given number.
hash key
field name to increment
increment
the value at field after the increment operation
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the field does not hold an integer value or if the value stored at key is not of
type hash
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.
Increments the float value of a hash field by the given amount.
Increments the float value of a hash field by the given amount.
hash key
field name to increment
increment
the value at field after the increment operation
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if the field does not hold a floating point value or if the value stored at key is
not of type hash
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.
Returns all the fields in a hash.
Returns all the fields in a hash.
hash key
set of field names or the empty set if the hash is empty or the key does not exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Returns the number of fields contained in the hash stored at key.
Returns the number of fields contained in the hash stored at key.
hash key
number of fields in the hash, or 0 if the key does not exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Incrementally iterates through the fields of a hash.
Incrementally iterates through the fields of a hash.
the offset
when defined, the command only returns elements matching the pattern
when defined, provides a hint of how many elements should be returned
a pair containing the next cursor as its first element and the list of fields (key-value pairs) as its second element
2.8.0
Sets the string value of a hash field.
Sets the string value of a hash field.
hash key
field name to set
value to set
true if field is a new field in the hash and value was set, false if field already exists and the value was updated
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
If the field already exists in the hash, it is overwritten.
Sets the value of a hash field, only if the field does not exist.
Sets the value of a hash field, only if the field does not exist.
hash key
field name to set
value to set
true if field is a new field in the hash and value was set, false if field already exists and no operation was performed
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Returns the length of the value associated with field in the hash stored at key.
Returns the length of the value associated with field in the hash stored at key. For numbers it is a count of their digits (+1 if number is negative) For booleans it is true=4 and false=5 For strings it is number of bytes they occupy. ONLY if you don't use utf characters it will be their length. If the key or the field do not exist, 0 is returned.
hash key
field name to set
the string length of the value associated with field, or zero when field is not present in the hash or key does not exist at all.
Returns all the values in a hash.
Returns all the values in a hash.
hash key
list of values, or the empty list if hash is empty or key does not exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Returns the values associated to the specified hash fields.
Returns the values associated to the specified hash fields.
hash key
field(s) to retrieve
list of value(s) associated to the specified field name(s)
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
For every field that does not exist, None
is returned.
Returns a Map
containing field-value pairs associated to the specified hash fields.
Returns a Map
containing field-value pairs associated to the specified hash fields.
hash key
field(s) to retrieve
field-value pairs associated to the specified field name(s)
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
Every non-existent field gets removed from the resulting Map
.
Sets multiple hash fields to multiple values.
Sets multiple hash fields to multiple values.
hash key
field-value pair(s) to be set
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
This command overwrites any existing fields in the hash. If key does not exist, a new key holding a hash is created
Executes a transaction and returns the results of all queued commands.
Executes a transaction and returns the results of all queued commands.
the transaction block
vector containing the results of all queued commands or failed future with IllegalArgumentException when operations count exceeds semaphore limit defined in configuration
1.2.0
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.
Gets information and statistics about the server.
Gets information and statistics about the server.
name of the section for which data should be retrieved
map of field -> value pairs that match the specified section, or an empty map if the section does not exist
1.0.0
The section can additionally take the following values: all
and default
.
Finds all keys matching the given pattern.
Finds all keys matching the given pattern.
pattern to search for
the matched keys, or the empty set if no keys match the given pattern
1.0.0
Returns an element from a list by its index.
Returns an element from a list by its index.
list key
zero-based position in the list
the requested element, or None
when index is out of range
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth.
Inserts an element before or after another element in a list.
Inserts an element before or after another element in a list.
list key
tell if a new value should be placed after of before pivot
value after/before which the element should be inserted
element to be inserted
the length of the list after the insert operation, or None if the index is out of range
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Returns the length of a list.
Returns the length of a list.
list key
the length of the list at key, or 0 if the key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Removes and returns the first element of a list.
Removes and returns the first element of a list.
list key
the popped element, or None
if the key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Prepends one or multiple values to a list.
Prepends one or multiple values to a list.
list key
value(s) to prepend
the length of the list after the push operations
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
If key does not exist, it is created as empty list before performing the push operation. Redis versions older than 2.4 can only push one value per call.
Prepends a value to a list, only if the list exists.
Prepends a value to a list, only if the list exists.
list key
value to prepend
the length of the list after the push operation
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Returns a range of elements from a list.
Returns a range of elements from a list.
list key
start offset (inclusive)
stop offset (inclusive)
list of elements in the specified range, or the empty list if there are no such elements or the key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
The offsets start and end are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list. For example, -1 is the last element of the list, -2 the penultimate, and so on. Both offsets are inclusive, i.e. LRANGE key 0 10 will return 11 elements (if they exist).
Removes the first count occurrences of elements equal to value from the list stored at key.
Removes the first count occurrences of elements equal to value from the list stored at key.
list key
value to be removed from the list
indicates the number of found values that should be removed, see above note
the number of removed elements
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
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.
Sets the value of an element in a list by its index.
Sets the value of an element in a list by its index.
list key
position of the element to set
value to be set at index
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if index is out of range or if key contains a non-list value
Trims a list to the specified range.
Trims a list to the specified range.
list key
start offset (inclusive)
stop offset (inclusive)
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Out of range indexes will not produce an error: if start is larger than the end of the list, or start > end, the result will be an empty list (which causes key to be removed). If end is larger than the end of the list, Redis will treat it like the last element of the list.
Gets the UNIX timestamp of the last successful save to disk.
Gets the UNIX timestamp of the last successful save to disk.
UNIX timestamp
1.0.0
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.
Atomically transfers a key from a Redis instance to another one.
Atomically transfers a key from a Redis instance to another one.
key to transfer
destination host
destination port
destination database
timeout duration, up to milliseconds precision
if true, do not remove the key from the local instance
if true, replace existing key on the remote instance
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if an error occurs
Moves a key to another database.
Moves a key to another database.
key to move
destination database
true if key was moved, false otherwise
1.0.0
Returns the kind of internal representation used in order to store the value associated with a key.
Returns the kind of internal representation used in order to store the value associated with a key.
the key
the object encoding or None
if the key does not exist
2.2.3
Objects can be encoded in different ways:
Strings can be encoded as raw
or int
Lists can be encoded as ziplist
or linkedlist
Sets can be encoded as intset
or hashtable
Hashes can be encoded as zipmap
or hashtable
SortedSets can be encoded as ziplist
or skiplist
Returns the number of seconds since the object stored at the specified key is idle (not requested by read or write operations).
Returns the number of seconds since the object stored at the specified key is idle (not requested by read or write operations).
the key
the number of seconds since the object is idle or None
if the key does not exist
2.2.3
While the value is returned in seconds the actual resolution of this timer is 10 seconds, but may vary in future implementations.
Returns the number of references of the value associated with the specified key.
Returns the number of references of the value associated with the specified key.
the key
the number of references or None
if the key does not exist
2.2.3
Sets a key's time to live in milliseconds.
Sets a key's time to live in milliseconds.
key to expire
time-to-live in milliseconds
true if the ttl was set, false if key does not exist or the timeout could not be set
2.6.0
Sets the expiration for a key as a UNIX timestamp specified in milliseconds.
Sets the expiration for a key as a UNIX timestamp specified in milliseconds.
key to expire
UNIX milliseconds-timestamp at which the key should expire
true if the ttl was set, false if key does not exist or the timeout could not be set
2.6.0
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.
Gets the time to live for a key in milliseconds.
Gets the time to live for a key in milliseconds.
result match { case Left(false) => // key does not exist case Left(true) => // key exists but has no associated expire case Right(ttl) => }
the target key
Right(ttl)
where ttl is the time-to-live in milliseconds for specified key,
Left(false)
if key does not exist or Left(true)
if key exists but has no associated
expire
2.6.0
For Redis
version <= 2.8.x, Left(false)
will be returned when the key does not
exists and when it exists but has no associated expire (Redis
returns the same error code
for both cases). In other words, you can simply check the following
result match { case Left(_) => case Right(ttl) => }
Removes the expiration from a key.
Removes the expiration from a key.
key to persist
true if key was persisted, false if key does not exist or does not have an associated timeout
2.2.0
Adds all the element arguments to the HyperLogLog data structure stored at specified key.
Adds all the element arguments to the HyperLogLog data structure stored at specified key.
the key of the HyperLogLog data structure
element(s) to add to the HyperLogLog data structure
true if at least one HyperLogLog internal register was altered, false otherwise
2.8.9
[[scredis.exceptions.RedisErrorResponseException]]
if key is not of HyperLogLog type
The HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself). The returned cardinality of the observed set is not exact, but approximated with a standard error of 0.81%.
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
When called with multiple keys, returns the approximated cardinality of the union of the HyperLogLogs passed, by internally merging the HyperLogLogs stored at the provided keys into a temporary HyperLogLog.
key(s) of the HyperLogLog data structure to count
the approximate number of unique elements observed via PFADD
2.8.9
[[scredis.exceptions.RedisErrorResponseException]]
if at least one key is not of HyperLogLog type
The HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself). The returned cardinality of the observed set is not exact, but approximated with a standard error of 0.81%.
Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
The computed merged HyperLogLog is set to the destination variable, which is created if does not exist (defauling to an empty HyperLogLog).
the destination key where the result should be stored
keys of the HyperLogLog data structure to merge
2.8.9
[[scredis.exceptions.RedisErrorResponseException]]
if at least one key is not of HyperLogLog type
The HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself). The returned cardinality of the observed set is not exact, but approximated with a standard error of 0.81%.
Pings the server.
Pings the server. This command is often used to test if a connection is still alive, or to measure latency.
PONG
1.0.0
Lists the currently active channels.
Lists the currently active channels. An active channel is a Pub/Sub channel with one or more subscribers (not including clients subscribed to patterns).
optional pattern to filter returned channels
the currently active channels, optionally matching the specified pattern
2.8.0
If no pattern is specified, all the channels are listed, otherwise if pattern is specified only channels matching the specified glob-style pattern are listed.
Returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command).
Returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command).
the number of subscriptions to patterns
2.8.0
Note that this is not just the count of clients subscribed to patterns but the total number of patterns all the clients are subscribed to.
Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels.
Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels.
channel name(s)
a map of channels to number of subscribers for every provided channel
2.8.0
Publishes a message to a channel.
Publishes a message to a channel.
the name of the channel
the message payload
the number of clients that received the message
2.0.0
Closes the connection.
Closes the connection.
1.0.0
Removes and returns the last element of a list.
Removes and returns the last element of a list.
list key
the popped element, or None
if the key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Removes the last element in a list, appends it to another list and returns it.
Removes the last element in a list, appends it to another list and returns it.
key of list to be pop from
key of list to be push to
the popped element, or None
if the key does not exist
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Appends one or multiple values to a list.
Appends one or multiple values to a list.
list key
value(s) to prepend
the length of the list after the push operations
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
If key does not exist, it is created as empty list before performing the push operation. Redis versions older than 2.4 can only push one value per call.
Appends a value to a list, only if the list exists.
Appends a value to a list, only if the list exists.
list key
value to prepend
the length of the list after the push operation
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
Returns a random key from the keyspace.
Returns a random key from the keyspace.
the random key or None
when the database is empty
associated timeout
1.0.0
Renames a key.
Renames a key.
source key
destination key
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the source and destination keys are the same, or when key
does not exist
if newKey already exists, it is overwritten
Renames a key, only if the new key does not exist.
Renames a key, only if the new key does not exist.
source key
destination key
true if key was renamed to newKey, false if newKey already exists
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the source and destination keys are the same, or when key does not exist
Creates a key using the provided serialized value, previously obtained using DUMP.
Creates a key using the provided serialized value, previously obtained using DUMP.
destination key
serialized value, previously obtained using DUMP
optional time-to-live duration of newly created key (expire)
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if the value could not be restored
Provides information on the role of a Redis instance in the context of replication, by returning if the instance is currently a master, slave, or sentinel.
Provides information on the role of a Redis instance in the context of replication, by returning if the instance is currently a master, slave, or sentinel.
the scredis.Role of the Redis
instance
2.8.12
The command also returns additional information about the state of the replication (if the role is master or slave) or the list of monitored master names (if the role is sentinel).
Adds one or more members to a set.
Adds one or more members to a set.
set key
member(s) to add
the number of members added to the set, not including all the members that were already present
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
Returns the number of members in a set.
Returns the number of members in a set.
set key
the cardinality (number of members) of the set, or 0 if key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
Returns the set resulting from the difference between the first set and all the successive sets.
Returns the set resulting from the difference between the first set and all the successive sets.
the key of the first set
key(s) of successive set(s) whose members will be substracted from the first one
the resulting set, or the empty set if the first key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
Stores the set resulting from the difference between the first set and all the successive sets.
Stores the set resulting from the difference between the first set and all the successive sets.
key where to store the resulting set
key of first set
keys of sets to be substracted from first set, if empty, first set is simply copied to destKey
the cardinality of the resulting set
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
If destKey already exists, it is overwritten.
Intersects multiple sets.
Intersects multiple sets.
keys of sets to be intersected together
the resulting set, or the empty set if the first key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
Intersects multiple sets and stores the resulting set in a key.
Intersects multiple sets and stores the resulting set in a key.
key where to store the resulting set
keys of sets to be intersected together, if only one is specified, it is simply copied to destKey
the cardinality of the resulting set
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
If destKey already exists, it is overwritten.
Determines if a given value is a member of a set.
Determines if a given value is a member of a set.
set key
value to be tested
true if the provided value is a member of the set stored at key, false otherwise
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
Returns all the members of a set.
Returns all the members of a set.
set key
set stored at key, or the empty set if key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
Moves a member from one set to another.
Moves a member from one set to another.
key of source set
value to be moved from source set to destination set
true if the member was moved, false if the element is not a member of source set and no operation was performed
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if sourceKey or destKey contains a value that is not a set
Removes and returns a random member from a set.
Removes and returns a random member from a set.
set key
random member, or None
if key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
This operation is similar to SRANDMEMBER, that returns a random element from a set but does not remove it.
Removes and returns a random 'count' members from a set.
Removes and returns a random 'count' members from a set.
set key
maximum number of returned elements
list of random members which size is less or equal to 'count'
3.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
This operation is similar to SRANDMEMBER, that returns a random element from a set but does not remove it.
Returns a random member from a set (without removing it).
Returns a random member from a set (without removing it).
set key
random member, or None
if key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
Returns a random member from a set (without removing it).
Returns a random member from a set (without removing it).
set key
number of member to randomly retrieve
set of random members, or the empty set if key does not exist
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
Removes one or more members from a set.
Removes one or more members from a set.
set key
members to remove from set
the number of members that were removed from the set, not including non-existing members
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
Redis versions older than 2.4 can only remove one member per call.
Incrementally iterates the elements of a set.
Incrementally iterates the elements of a set.
the offset
when defined, the command only returns elements matching the pattern
when defined, provides a hint of how many elements should be returned
a pair containing the next cursor as its first element and the set of elements as its second element
2.8.0
Computes the union of multiple sets.
Computes the union of multiple sets.
keys of sets to be included in the union computation
the resulting set, or the empty set if the first key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
Computes the union of multiple sets and stores the resulting set in a key.
Computes the union of multiple sets and stores the resulting set in a key.
key where to store the resulting set
keys of sets to be included in the union computation, if only one is specified, it is simply copied to destKey
the cardinality of the resulting set
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
If destKey already exists, it is overwritten.
Synchronously saves the dataset to disk.
Synchronously saves the dataset to disk.
1.0.0
Incrementally iterates the set of keys in the currently selected Redis database.
Incrementally iterates the set of keys in the currently selected Redis database.
the offset
when defined, the command only returns elements matching the pattern
when defined, provides a hint of how many elements should be returned
a pair containing the next cursor as its first element and the set of keys as its second element
2.8.0
Checks existence of scripts in the script cache.
Checks existence of scripts in the script cache.
SHA1 digest(s) to check for existence
SHA1 -> Boolean Map
where true means the script associated to the sha1 exists
in the cache
2.6.0
Removes all the scripts from the script cache.
Removes all the scripts from the script cache.
2.6.0
Kills the currently executing Lua script, assuming no write operation was yet performed by the script.
Kills the currently executing Lua script, assuming no write operation was yet performed by the script.
2.6.0
If the script already performed write operations it can not be killed in this way because it would violate Lua script atomicity contract. In such a case only SHUTDOWN NOSAVE is able to kill the script, killing the Redis process in an hard way preventing it to persist with half-written information.
Loads or stores the specified Lua script into the script cache.
Loads or stores the specified Lua script into the script cache.
the script to be loaded into the cache
the SHA1 digest of the stored script
2.6.0
[[scredis.exceptions.RedisErrorResponseException]]
if a compilation error occurs
The script is guaranteed to stay in the script cache forever (unless SCRIPT FLUSH is called).
Changes the selected database on the current connection.
Changes the selected database on the current connection.
database index
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if the database index is invalid
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.
Gracefully shuts down a Redis
server.
Gracefully shuts down a Redis
server.
optional scredis.ShutdownModifier
1.0.0
The command performs the following operations:
- Stops all the clients
- Performs a blocking SAVE
if at least one save point is configured
- Flushes the Append Only File if AOF is enabled
- Quits the server
Configures the current Redis
instance as a slave of another Redis
instance.
Configures the current Redis
instance as a slave of another Redis
instance.
the host of the master instance
the port of the master instance
1.0.0
Breaks the replication of a slave instance
, turning it back into a master instance.
Breaks the replication of a slave instance
, turning it back into a master instance.
1.0.0
Retieves entries from the slowlog.
Retieves entries from the slowlog.
optionally limits the number of retrieved entries
list of slowlog entries
2.2.12
Returns the number of entries in the slowlog.
Returns the number of entries in the slowlog.
number of entries in the slowlog
2.2.12
Resets the slowlog.
Resets the slowlog.
2.2.12
Sorts the elements of a list, set or sorted set.
Sorts the elements of a list, set or sorted set.
key of list, set or sorted set to be sorted
optional pattern for sorting by external values, can also be "nosort" if the sorting operation should be skipped (useful when only sorting to retrieve objects with get). The * gets replaced by the values of the elements in the collection
optional pair of numbers (offset, count) where offset specified the number of elements to skip and count specifies the number of elements to return starting from offset
list of patterns for retrieving objects stored in external keys. The * gets replaced by the values of the elements in the collection
indicates whether elements should be sorted descendingly
indicates whether elements should be sorted lexicographically
the sorted list of elements, or the empty list if the key does not exist
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
whenever an error occurs
Sorts the elements of a list, set or sorted set and then store the result.
Sorts the elements of a list, set or sorted set and then store the result.
key of list, set or sorted set to be sorted
key of list, set or sorted set to be sorted
optional pattern for sorting by external values, can also be "nosort" if the sorting operation should be skipped (useful when only sorting to retrieve objects with get). The * gets replaced by the values of the elements in the collection
optional pair of numbers (offset, count) where offset specified the number of elements to skip and count specifies the number of elements to return starting from offset
list of patterns for retrieving objects stored in external keys. The * gets replaced by the values of the elements in the collection
indicates whether elements should be sorted descendingly
indicates whether elements should be sorted lexicographically
the number of elements in the newly stored sorted collection
1.0.0
[[scredis.exceptions.RedisErrorResponseException]]
whenever an error occurs
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
Returns the current server time.
Returns the current server time.
pair of longs containing (1) UNIX timestamp and (2) microseconds
2.6.0
Gets the time to live for a key in seconds.
Gets the time to live for a key in seconds.
result match { case Left(false) => // key does not exist case Left(true) => // key exists but has no associated expire case Right(ttl) => }
the target key
Right(ttl)
where ttl is the time-to-live in seconds for specified key,
Left(false)
if key does not exist or Left(true)
if key exists but has no associated
expire
1.0.0
For Redis
version <= 2.8.x, Left(false)
will be returned when the key does not
exists and when it exists but has no associated expire (Redis
returns the same error code
for both cases). In other words, you can simply check the following
result match { case Left(_) => case Right(ttl) => }
Determine the type stored at key.
Determine the type stored at key.
key for which the type should be returned
type of key, or None
if key does not exist
1.0.0
This method needs to be called as follows:
client.`type`(key)
Forgets about all watched keys.
Forgets about all watched keys.
2.2.0
Watches the given keys, which upon modification, will abort a transaction.
Watches the given keys, which upon modification, will abort a transaction.
keys to watch
2.2.0
Executes a transaction and returns whatever the transaction block returns.
Executes a transaction and returns whatever the transaction block returns.
the transaction block
whatever 'build' returns
1.2.0
RedisTransactionBuilderException
when exception occurs during building transaction
Adds one or more members to a sorted set, or update its score if it already exists.
Adds one or more members to a sorted set, or update its score if it already exists.
sorted set key
member-score pairs to be added
the number of elements added to the sorted sets, not including elements already existing for which the score was updated
2.4
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
Adds a member to a sorted set, or update its score if it already exists.
Adds a member to a sorted set, or update its score if it already exists.
sorted set key
member to add
score of the member to add
true if the member was added, or false if the member already exists
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
Returns the number of members in a sorted set.
Returns the number of members in a sorted set.
sorted set key
the cardinality (number of elements) of the sorted set, or 0 if key does not exist
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Returns the number of elements of a sorted set belonging to a given score range.
Returns the number of elements of a sorted set belonging to a given score range.
sorted set key
score lower bound
score upper bound
the number of elements in the specified score range
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Increments the score of a member in a sorted set.
Increments the score of a member in a sorted set.
sorted set key
member whose score needs to be incremented
the increment
the new score of member
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
keys of sorted sets to intersect
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
key to weight pairs
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Returns the number of elements of a sorted set belonging to a given lexical score range.
Returns the number of elements of a sorted set belonging to a given lexical score range.
sorted set key
lexical score lower bound
lexical score upper bound
the number of elements in the specified lexical score range
2.8.9
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
Returns a range of members in a sorted set, by index.
Returns a range of members in a sorted set, by index.
sorted set key
start offset (inclusive)
stop offset (inclusive)
the set of ascendingly ordered elements in the specified range, or the empty set if key does not exist
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next
element and so on. They can also be negative numbers indicating offsets from the end of the
sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and
so on. Out of range indexes will not produce an error. If start is larger than the largest
index in the sorted set, or start
> end
, an empty list is returned. If end
is larger
than the end of the sorted set Redis will treat it like it is the last element of the
sorted set. The indexes are inclusive.
Returns a range of members in a sorted set, by lexical score.
Returns a range of members in a sorted set, by lexical score.
sorted set key
lexical score lower bound
lexical score upper bound
optional offset and count pair used to limit the number of matching elements
the set of ascendingly ordered elements in the specified lexical range, or the empty set if key does not exist
2.8.9
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
Returns a range of members in a sorted set, by score.
Returns a range of members in a sorted set, by score.
sorted set key
score lower bound
score upper bound
optional offset and count pair used to limit the number of matching elements
the set of ascendingly ordered elements in the specified score range, or the empty set if key does not exist
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
The elements having the same score are returned in lexicographical order (this follows from a property of the sorted set implementation in Redis and does not involve further computation).
Returns a range of members with associated scores in a sorted set, by score.
Returns a range of members with associated scores in a sorted set, by score.
sorted set key
score lower bound
score upper bound
optional offset and count pair used to limit the number of matching elements
the set of ascendingly ordered element-score pairs in the specified score range, or the empty set if key does not exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
The elements having the same score are returned in lexicographical order (this follows from a property of the sorted set implementation in Redis and does not involve further computation).
Returns a range of members with associated scores in a sorted set, by index.
Returns a range of members with associated scores in a sorted set, by index.
sorted set key
start offset (inclusive)
end offset (inclusive)
the set of ascendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next
element and so on. They can also be negative numbers indicating offsets from the end of the
sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and
so on. Out of range indexes will not produce an error. If start is larger than the largest
index in the sorted set, or start
> end
, an empty list is returned. If end
is larger
than the end of the sorted set Redis will treat it like it is the last element of the
sorted set. The indexes are inclusive.
Determines the index of a member in a sorted set.
Determines the index of a member in a sorted set.
sorted set key
the value
the rank or index of the member, or None
if the member is not in the set or the key
does not exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Removes one or more members from a sorted set.
Removes one or more members from a sorted set.
sorted set key
additional values to be removed (only works with Redis >= 2.4)
the number of members removed from the sorted set, not including non existing members
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Redis versions older than 2.4 can only remove one value per call.
Removes all members in a sorted set within the given lexical range.
Removes all members in a sorted set within the given lexical range.
sorted set key
lexical score lower bound
lexical score upper bound
the number of removed elements
2.8.9
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
Removes all members in a sorted set within the given indexes.
Removes all members in a sorted set within the given indexes.
sorted set key
the start offset or index (inclusive)
the stop offset or index (inclusive)
the number of members removed
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Both start and stop are zero-based inclusive indexes with 0 being the element with the lowest score. These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth.
Removes all members in a sorted set within the given scores range.
Removes all members in a sorted set within the given scores range.
sorted set key
score lower bound
score upper bound
the number of members removed
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Since version 2.1.6, min and max can be exclusive, following the syntax of ZRANGEBYSCORE.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
sorted set key
start offset (inclusive)
stop offset (inclusive)
the set of descendingly ordered elements in the specified range, or the empty set if key does not exist
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE.
Returns a range of members in a sorted set, by score, with scores ordered from high to low.
Returns a range of members in a sorted set, by score, with scores ordered from high to low.
sorted set key
score upper bound
score lower bound
optional offset and count pair used to limit the number of matching elements
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
Return a range of members with associated scores in a sorted set, by score, with scores ordered from high to low.
Return a range of members with associated scores in a sorted set, by score, with scores ordered from high to low.
sorted set key
score upper bound
score lower bound
optional offset and count pair used to limit the number of matching elements
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
2.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
sorted set key
start offset (inclusive)
stop offset (inclusive)
the set of descendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE. The elements having the same score are returned in reverse lexicographical order.
Determine the index of a member in a sorted set, with scores ordered from high to low.
Determine the index of a member in a sorted set, with scores ordered from high to low.
sorted set key
the value
the rank or index of the member, or None
if the member is not in the set or the key
does not exist
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Incrementally iterates the elements (value-score pairs) of a sorted set.
Incrementally iterates the elements (value-score pairs) of a sorted set.
the offset
when defined, the command only returns elements matching the pattern
when defined, provides a hint of how many elements should be returned
a pair containing the next cursor as its first element and the sorted set of elements (value-score pairs) as its second element
2.8.0
Returns the score associated with the given member in a sorted set.
Returns the score associated with the given member in a sorted set.
sorted set key
the value
the score of member, or None
if the latter is not in the sorted set or the key does
not exist
1.2.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
keys of sorted sets
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
sorted set key
aggregation function (default is Sum)
the number of elements in the resulting sorted set stored at destKey
2.0.0
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
Defines a Redis client supporting all non-blocking commands.