Redis
public class Redis
The Redis
class represents a handle for issueing commands to a Redis server.
It provides a set of type safe functions for issueing those commands.
-
Whether the client is connected or not
Declaration
Swift
public var connected: Bool
-
Initializes a
Redis
instanceDeclaration
Swift
public init ()
-
Connects to a redis server
Parameter
Parameter host: the server IP address.Parameter
Parameter port: port number.Parameter
Parameter callback: callback function for on completion, NSError will be nil if successful.Declaration
Swift
public func connect (host: String, port: Int32, callback: (NSError?) -> Void)
Parameters
host
the server IP address.
port
port number.
callback
callback function for on completion, NSError will be nil if successful.
-
Authenticate against the server
Parameter
Parameter pswd: String for the password.Parameter
Parameter callback: callback function that is called after authenticating, NSError will be nil if successful.Declaration
Swift
public func auth(_ pswd: String, callback: (NSError?) -> Void)
Parameters
pswd
String for the password.
callback
callback function that is called after authenticating, NSError will be nil if successful.
-
Select the database to use
Parameter
Parameter db: numeric index for the database.Parameter
Parameter callback: callback function for after the database is selected, NSError will be nil if successful.Declaration
Swift
public func select(_ db: Int, callback: (NSError?) -> Void)
Parameters
db
numeric index for the database.
callback
callback function for after the database is selected, NSError will be nil if successful.
-
Ping the server to test if a connection is still alive
Parameter
Parameter pingStr: String for the ping message.Parameter
Parameter callback: callback function for after the pong is received, NSError will be nil if successful.Declaration
Swift
public func ping(_ pingStr: String?=nil, callback: (NSError?) -> Void)
Parameters
pingStr
String for the ping message.
callback
callback function for after the pong is received, NSError will be nil if successful.
-
Echos a message
Parameter
Parameter str: String for the message.Parameter
Parameter callback: callback function with the String echoed back, NSError will be nil if successful.Declaration
Swift
public func echo(_ str: String, callback: (RedisString?, NSError?) -> Void)
Parameters
str
String for the message.
callback
callback function with the String echoed back, NSError will be nil if successful.
-
Get information and statistics about the server
Parameter
Parameter callback: callback function with the response as a collection of text lines. NSError will be nil if successful.Declaration
Swift
public func info(callback: (RedisString?, NSError?) -> Void)
Parameters
callback
callback function with the response as a collection of text lines. NSError will be nil if successful.
-
Get information and statistics about the server
Parameter
Parameter callback: callback function with the response as a struct containing some client and server information, NSError will be nil if successful.Declaration
Swift
public func info(callback: (RedisInfo?, NSError?) -> Void)
Parameters
callback
callback function with the response as a struct containing some client and server information, NSError will be nil if successful.
-
Delete all the keys of the currently selected DB. This command never fails.
Parameter
Parameter callback: a function returning the response, NSError will be nil if successful.Declaration
Swift
public func flushdb(callback: (Bool, NSError?) -> Void)
Parameters
callback
a function returning the response, NSError will be nil if successful.
-
Create a
RedisMulti
object in order to perform a Redis transactionDeclaration
Swift
public func multi() -> RedisMulti
-
Issue a Redis command
Parameter
Parameter stringArgs: A list of Strings making up the Redis command to issueParameter
Parameter callback: a function returning the response in the form of aRedisResponse
Declaration
Swift
public func issueCommand(_ stringArgs: String..., callback: (RedisResponse) -> Void)
Parameters
stringArgs
A list of Strings making up the Redis command to issue
callback
a function returning the response in the form of a
RedisResponse
-
Issue a Redis command
Parameter
Parameter stringArgs: An array of Strings making up the Redis command to issueParameter
Parameter callback: a function returning the response in the form of aRedisResponse
Declaration
Swift
public func issueCommandInArray(_ stringArgs: [String], callback: (RedisResponse) -> Void)
Parameters
stringArgs
An array of Strings making up the Redis command to issue
callback
a function returning the response in the form of a
RedisResponse
-
Issue a Redis command
Parameter
Parameter stringArgs: A list ofRedisString
objects making up the Redis command to issueParameter
Parameter callback: a function returning the response in the form of aRedisResponse
Declaration
Swift
public func issueCommand(_ stringArgs: RedisString..., callback: (RedisResponse) -> Void)
Parameters
stringArgs
A list of
RedisString
objects making up the Redis command to issuecallback
a function returning the response in the form of a
RedisResponse
-
Issue a Redis command
Parameter
Parameter stringArgs: An array ofRedisString
objects making up the Redis command to issueParameter
Parameter callback: a function returning the response in the form of aRedisResponse
Declaration
Swift
public func issueCommandInArray(_ stringArgs: [RedisString], callback: (RedisResponse) -> Void)
Parameters
stringArgs
An array of
RedisString
objects making up the Redis command to issuecallback
a function returning the response in the form of a
RedisResponse
-
If the key already exists and is a string, this command appends the value at the end of the string
Parameter
Parameter key: The key.Parameter
Parameter value: The value to append.Parameter
Parameter callback: The callback function, the Int will contain the length of the string after the append operation. NSError will be non-nil if an error occurred.Declaration
Swift
public func append(_ key: String, value: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
value
The value to append.
callback
The callback function, the Int will contain the length of the string after the append operation. NSError will be non-nil if an error occurred.
-
Count the number of set bits (population counting) in a string. /// - Parameter key: The key. - Parameter callback: The callback function, the Int will contain the number of bits set to 1. NSError will be non-nil if an error occurred.
Declaration
Swift
public func bitcount(_ key: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Int will contain the number of bits set to 1. NSError will be non-nil if an error occurred.
-
Count the number of set bits (population counting) in a string.
Parameter
Parameter key: The key.Parameter
Parameter start: The starting index in the string to count fromParameter
Parameter end: The ending index in the string to count to.Parameter
Parameter callback: The callback function, the Int will contain the number of bits set to 1. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitcount(_ key: String, start: Int, end: Int, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
start
The starting index in the string to count from
end
The ending index in the string to count to.
callback
The callback function, the Int will contain the number of bits set to 1. NSError will be non-nil if an error occurred.
-
Perform a bitwise AND operation between multiple keys and store the result at the destination key.
Parameter
Parameter destKey: The destination key.Parameter
Parameter and: The list of keys whose values will be AND'ed.Parameter
Parameter callback: The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitop(_ destKey: String, and: String..., callback: (Int?, NSError?) -> Void)
Parameters
destKey
The destination key.
and
The list of keys whose values will be AND’ed.
callback
The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.
-
Perform a bitwise NOT operation on the value at a key and store the result at the destination key.
Parameter
Parameter destKey: The destination key.Parameter
Parameter not: The key of the value to be NOT'ed.Parameter
Parameter callback: The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitop(_ destKey: String, not: String, callback: (Int?, NSError?) -> Void)
Parameters
destKey
The destination key.
not
The key of the value to be NOT’ed.
callback
The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.
-
Perform a bitwise OR operation between multiple keys and store the result at the destination key.
Parameter
Parameter destKey: The destination key.Parameter
Parameter or: The list of keys whose values will be OR'ed.Parameter
Parameter callback: The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitop(_ destKey: String, or: String..., callback: (Int?, NSError?) -> Void)
Parameters
destKey
The destination key.
or
The list of keys whose values will be OR’ed.
callback
The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.
-
Perform a bitwise XOR operation between multiple keys and store the result at the destination key.
Parameter
Parameter destKey: The destination key.Parameter
Parameter xor: The list of keys whose values will be XOR'ed.Parameter
Parameter callback: The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitop(_ destKey: String, xor: String..., callback: (Int?, NSError?) -> Void)
Parameters
destKey
The destination key.
xor
The list of keys whose values will be XOR’ed.
callback
The callback function, the Int will contain the length of the string stored at the destination key. NSError will be non-nil if an error occurred.
-
Return the position of the first bit set to 1 or 0 in a string
Parameter
Parameter key: The key.Parameter
Parameter bit: The value to compare against.Parameter
Parameter callback: The callback function, the Int will contain the index in the string where the bit value matches the comparison value. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitpos(_ key: String, bit: Bool, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
bit
The value to compare against.
callback
The callback function, the Int will contain the index in the string where the bit value matches the comparison value. NSError will be non-nil if an error occurred.
-
Return the position of the first bit set to 1 or 0 in a string
Parameter
Parameter key: The key.Parameter
Parameter bit: The value to compare against.Parameter
Parameter start: The starting index in the string to search from.Parameter
Parameter callback: The callback function, the Int will contain the index in the string where the bit value matches the comparison value. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitpos(_ key: String, bit: Bool, start: Int, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
bit
The value to compare against.
start
The starting index in the string to search from.
callback
The callback function, the Int will contain the index in the string where the bit value matches the comparison value. NSError will be non-nil if an error occurred.
-
Return the position of the first bit set to 1 or 0 in a string
Parameter
Parameter key: The key.Parameter
Parameter bit: The value to compare against.Parameter
Parameter start: The starting index in the string to search from.Parameter
Parameter end: The ending index in the string to search until.Parameter
Parameter callback: The callback function, the Int will contain the index in the string where the bit value matches the comparison value. NSError will be non-nil if an error occurred.Declaration
Swift
public func bitpos(_ key: String, bit: Bool, start: Int, end: Int, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
bit
The value to compare against.
start
The starting index in the string to search from.
end
The ending index in the string to search until.
callback
The callback function, the Int will contain the index in the string where the bit value matches the comparison value. NSError will be non-nil if an error occurred.
-
Decrements the integer number stored at the key by a value. If the key does not exist, it is set to 0 before performing the operation.
Parameter
Parameter key: The key.Parameter
Parameter by: An integer number that will be subtracted from the value at the key.Parameter
Parameter callback: The callback function, the Int will be the value of the key after the decrement. NSError will be non-nil if an error occurred.
Note
This is a string operation since Redis does not have a dedicated integer type
Declaration
Swift
public func decr(_ key: String, by: Int=1, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
by
An integer number that will be subtracted from the value at the key.
callback
The callback function, the Int will be the value of the key after the decrement. NSError will be non-nil if an error occurred.
-
Removes the specified keys. A key is ignored if it does not exist
Parameter
Parameter keys: A list of keys.Parameter
Parameter callback: callback function, the Int is the number of keys deleted. NSError will be non-nil if an error occurred.Declaration
Swift
public func del(_ keys: String..., callback: (Int?, NSError?) -> Void)
Parameters
keys
A list of keys.
callback
callback function, the Int is the number of keys deleted. NSError will be non-nil if an error occurred.
-
Removes the specified keys. A key is ignored if it does not exist
Parameter
Parameter keys: A list of keys in the form ofRedisString
s.Parameter
Parameter callback: The callback function, the Int is the number of keys deleted. NSError will be non-nil if an error occurred.Declaration
Swift
public func del(_ keys: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
keys
A list of keys in the form of
RedisString
s.callback
The callback function, the Int is the number of keys deleted. NSError will be non-nil if an error occurred.
-
Check if one or more keys exist
Parameter
Parameter keys: A list of keys.Parameter
Parameter callback: The callback function, the Int will contain the number of the specified keys that exist. NSError will be non-nil if an error occurred.Declaration
Swift
public func exists(_ keys: String..., callback: (Int?, NSError?) -> Void)
Parameters
keys
A list of keys.
callback
The callback function, the Int will contain the number of the specified keys that exist. NSError will be non-nil if an error occurred.
-
Set a timeout on a key. After the timeout has expired, the key will automatically be deleted. A key with an associated timeout is often said to be volatile in Redis terminology.
Parameter
Parameter key: The key.Parameter
Parameter inTime: The expiration period as a number of milliseconds.Parameter
Parameter callback: The callback function, the Bool will contain true if the timeout was set. NSError will be non-nil if an error occurred.Declaration
Swift
public func expire(_ key: String, inTime: TimeInterval, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
inTime
The expiration period as a number of milliseconds.
callback
The callback function, the Bool will contain true if the timeout was set. NSError will be non-nil if an error occurred.
-
Set a timeout on a key. After the timeout has expired, the key will automatically be deleted. A key with an associated timeout is often said to be volatile in Redis terminology.
Parameter
Parameter key: The key.Parameter
Parameter atDate: The key’s expiration specified as a timestamp.Parameter
Parameter callback: The callback function, the Bool will contain true if the timeout was set. NSError will be non-nil if an error occurred.Declaration
Swift
public func expire(_ key: String, atDate: NSDate, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
atDate
The key’s expiration specified as a timestamp.
callback
The callback function, the Bool will contain true if the timeout was set. NSError will be non-nil if an error occurred.
-
Get the value of a key.
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function with the value of the key. NSError will be non-nil if an error occurred.Declaration
Swift
public func get(_ key: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function with the value of the key. NSError will be non-nil if an error occurred.
-
Returns the bit at an offset in the string value stored at the key.
Parameter
Parameter key: The key.Parameter
Parameter offset: The offset in the string value.Parameter
Parameter callback: The callback function, the Bool will conatain the bit value stored at the offset. NSError will be non-nil if an error occurred.Declaration
Swift
public func getbit(_ key: String, offset: Int, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
offset
The offset in the string value.
callback
The callback function, the Bool will conatain the bit value stored at the offset. NSError will be non-nil if an error occurred.
-
Returns a substring of the string value stored at the key, determined by the offsets start and end. Negative offsets can be used in order to provide an offset starting from the end of the string.
Parameter
Parameter key: The key.Parameter
Parameter start: Integer index for the starting position of the substring.Parameter
Parameter end: Integer index for the ending position of the substring.Parameter
Parameter callback: The callback function, theRedisString
will contain the substring. NSError will be non-nil if an error occurred.Declaration
Swift
public func getrange(_ key: String, start: Int, end: Int, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
start
Integer index for the starting position of the substring.
end
Integer index for the ending position of the substring.
callback
The callback function, the
RedisString
will contain the substring. NSError will be non-nil if an error occurred. -
Atomically sets a key to a value and returns the old value stored at the key.
Parameter
Parameter key: The key.Parameter
Parameter value: The String value to set.Parameter
Parameter callback: The callback function, theRedisString
will contain the old value. NSError will be non-nil if an error occurred.Declaration
Swift
public func getSet(_ key: String, value: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
value
The String value to set.
callback
The callback function, the
RedisString
will contain the old value. NSError will be non-nil if an error occurred. -
Atomically sets a key to a value and returns the old value stored at the key.
Parameter
Parameter key: The key.Parameter
Parameter value: TheRedisString
value to set.Parameter
Parameter callback: The callback function, theRedisString
will contain the old value. NSError will be non-nil if an error occurred.Declaration
Swift
public func getSet(_ key: String, value: RedisString, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
value
The
RedisString
value to set.callback
The callback function, the
RedisString
will contain the old value. NSError will be non-nil if an error occurred. -
Increments the number stored at the key by a value. If the key does not exist, it is set to 0 before performing the operation.
Parameter
Parameter key: The key.Parameter
Parameter by: A number that will be added to the value at the key.Parameter
Parameter callback: The callback function, the Int will be the value of the key after the increment. NSError will be non-nil if an error occurred.
Note
This is a string operation since Redis does not have a dedicated integer type
Declaration
Swift
public func incr(_ key: String, by: Int=1, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
by
A number that will be added to the value at the key.
callback
The callback function, the Int will be the value of the key after the increment. NSError will be non-nil if an error occurred.
-
Increments the floating point number stored at the key by a value. If the key does not exist, it is set to 0 before performing the operation.
Parameter
Parameter key: The key.Parameter
Parameter byFloat: A floating point number that will be added to the value at the key.Parameter
Parameter callback: The callback function, the
RedisString
will be the value of the key after the increment. NSError will be non-nil if an error occurred.Note
This is a string operation since Redis does not have a dedicated float type
Declaration
Swift
public func incr(_ key: String, byFloat: Float, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
byFloat
A floating point number that will be added to the value at the key.
callback
The callback function, the
RedisString
will be the value of the key after the increment. NSError will be non-nil if an error occurred. -
Returns the value of all the specified keys.
Parameter
Parameter keys: The list of keys.Parameter
Parameter callback: The callback function, the array ofRedisString
will be the values returned for the keys, in the order of the keys. NSError will be non-nil if an error occurred.Declaration
Swift
public func mget(_ keys: String..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of keys.
callback
The callback function, the array of
RedisString
will be the values returned for the keys, in the order of the keys. NSError will be non-nil if an error occurred. -
Move a key from the currently selected database to the specified destination database. When the key already exists in the destination database, or it does not exist in the source database, nothing is done.
Parameter
Parameter key: The key.Parameter
Parameter toDB: The number of the database to move the key to.Parameter
Parameter callback: The callback function, the Bool will be true if the key was moved. NSError will be non-nil if an error occurred.Declaration
Swift
public func move(_ key: String, toDB: Int, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
toDB
The number of the database to move the key to.
callback
The callback function, the Bool will be true if the key was moved. NSError will be non-nil if an error occurred.
-
Sets a set key value pairs in the database
Parameter
Parameter keyValuePairs: A list of tuples containing a key and a value.Parameter
Parameter exists: If true, will set the value only if the key already exists.Parameter
Parameter callback: The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func mset(_ keyValuePairs: (String, String)..., exists: Bool=true, callback: (Bool, NSError?) -> Void)
Parameters
keyValuePairs
A list of tuples containing a key and a value.
exists
If true, will set the value only if the key already exists.
callback
The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.
-
Sets a set key value pairs in the database
Parameter
Parameter keyValuePairs: An array of tuples containing a key and a value.Parameter
Parameter exists: If true, will set the value only if the key already exists.Parameter
Parameter callback: The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func msetArrayOfKeyValues(_ keyValuePairs: [(String, String)], exists: Bool=true, callback: (Bool, NSError?) -> Void)
Parameters
keyValuePairs
An array of tuples containing a key and a value.
exists
If true, will set the value only if the key already exists.
callback
The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.
-
Sets the given keys to their respective values.
Parameter
Parameter keyValuePairs: A list of tuples containing a key and value in the form of aRedisString
.Parameter
Parameter exists: If true, will set the value only if the key already exists.Parameter
Parameter callback: The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func mset(_ keyValuePairs: (String, RedisString)..., exists: Bool=true, callback: (Bool, NSError?) -> Void)
Parameters
keyValuePairs
A list of tuples containing a key and value in the form of a
RedisString
.exists
If true, will set the value only if the key already exists.
callback
The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.
-
Sets the given keys to their respective values.
Parameter
Parameter keyValuePairs: An array of tuples containing a key and a value in the form of aRedisString
.Parameter
Parameter exists: If true, will set the value only if the key already exists.Parameter
Parameter callback: The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func msetArrayOfKeyValues(_ keyValuePairs: [(String, RedisString)], exists: Bool=true, callback: (Bool, NSError?) -> Void)
Parameters
keyValuePairs
An array of tuples containing a key and a value in the form of a
RedisString
.exists
If true, will set the value only if the key already exists.
callback
The callback function, the Bool will be true if the keys were set. NSError will be non-nil if an error occurred.
-
Remove the existing timeout on a key, turning the key from volatile (a key with an expiration) to persistent (a key that will never expire as no timeout is associated with it)
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Bool will contain true if the timeout was removed. NSError will be non-nil if an error occurred.Declaration
Swift
public func persist(_ key: String, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Bool will contain true if the timeout was removed. NSError will be non-nil if an error occurred.
-
Renames a key. It returns an error if the original and new names are the same, or when the original key does not exist.
Parameter
Parameter key: The key.Parameter
Parameter newKey: The new name for the key.Parameter
Parameter exists: If true, will rename the key even if the newKey already exists.Parameter
Parameter callback: The callback function, the Bool will be true if the key was renamed. NSError will be non-nil if an error occurred.Declaration
Swift
public func rename(_ key: String, newKey: String, exists: Bool=true, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
newKey
The new name for the key.
exists
If true, will rename the key even if the newKey already exists.
callback
The callback function, the Bool will be true if the key was renamed. NSError will be non-nil if an error occurred.
-
Set a key to hold a value. If key already holds a value, it is overwritten.
Parameter
Parameter key: The key.Parameter
Parameter value: The String value to set.Parameter
Parameter exists: If true will only set the key if it already exists.Parameter
Parameter expiresIn: If not nil, the expiration time, in milliseconds.Parameter
Parameter callback: The callback function after setting the value. Bool will be true if the key was set. NSError will be non-nil if an error occurred.Declaration
Swift
public func set(_ key: String, value: String, exists: Bool?=nil, expiresIn: TimeInterval?=nil, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
value
The String value to set.
exists
If true will only set the key if it already exists.
expiresIn
If not nil, the expiration time, in milliseconds.
callback
The callback function after setting the value. Bool will be true if the key was set. NSError will be non-nil if an error occurred.
-
Set a key to hold a value. If key already holds a value, it is overwritten.
Parameter
Parameter key: The key.Parameter
Parameter value: TheRedisString
value to set.Parameter
Parameter exists: If true will only set the key if it already exists.Parameter
Parameter expiresIn: If not nil, the expiration time, in milliseconds.Parameter
Parameter callback: The callback function after setting the value. Bool will be true if the key was set. NSError will be non-nil if an error occurred.Declaration
Swift
public func set(_ key: String, value: RedisString, exists: Bool?=nil, expiresIn: TimeInterval?=nil, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
value
The
RedisString
value to set.exists
If true will only set the key if it already exists.
expiresIn
If not nil, the expiration time, in milliseconds.
callback
The callback function after setting the value. Bool will be true if the key was set. NSError will be non-nil if an error occurred.
-
Sets the bit value at an offset in the string value stored at the key.
Parameter
Parameter key: The key.Parameter
Parameter offset: The offset in the string value.Parameter
Parameter value: The bit value to set.Parameter
Parameter callback: The callback function, the Bool will conatain the original bit value stored at the offset. NSError will be non-nil if an error occurred.Declaration
Swift
public func setbit(_ key: String, offset: Int, value: Bool, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
offset
The offset in the string value.
value
The bit value to set.
callback
The callback function, the Bool will conatain the original bit value stored at the offset. NSError will be non-nil if an error occurred.
-
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value
Parameter
Parameter key: The key.Parameter
Parameter offset: Integer index for the starting position within the key’s value to overwrite.Parameter
Parameter value: The String value to overwrite the value of the key with.Parameter
Parameter callback: The callback function, the Int will contain the length of the key’s value after it was modified by the command. NSError will be non-nil if an error occurred.Declaration
Swift
public func setrange(_ key: String, offset: Int, value: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
offset
Integer index for the starting position within the key’s value to overwrite.
value
The String value to overwrite the value of the key with.
callback
The callback function, the Int will contain the length of the key’s value after it was modified by the command. NSError will be non-nil if an error occurred.
-
Returns the length of the string value stored at the key
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Int will contain the length of the string. NSError will be non-nil if an error occurred.Declaration
Swift
public func strlen(_ key: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Int will contain the length of the string. NSError will be non-nil if an error occurred.
-
Get the remaining time to live of a key that has an expiration period set.
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the TimeInterval will contain:- The remaining time to live of the key, specified in milliseconds
- -2 if the key does not exist
- -1 if the key exists but has no associated expiration period. NSError will be non-nil if an error occurred.
Declaration
Swift
public func ttl(_ key: String, callback: (TimeInterval?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the TimeInterval will contain:
-
Removes the specified fields from the hash stored at a key. 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.
Parameter
Parameter key: The key.Parameter
Parameter fields: The list of fields to remove.Parameter
Parameter callback: The callback function, the Int will contain the number of fields that were removed from the hash, not including specified but non existing fields. NSError will be non-nil if an error occurred.Declaration
Swift
public func hdel(_ key: String, fields: String..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
fields
The list of fields to remove.
callback
The callback function, the Int will contain the number of fields that were removed from the hash, not including specified but non existing fields. NSError will be non-nil if an error occurred.
-
Determine if the specified field exists in the hash stored at a key
Parameter
Parameter key: The key.Parameter
Parameter field: The field.Parameter
Parameter callback: The callback function, Bool will contain true if the hash exists and contains the specified field. NSError will be non-nil if an error occurred.Declaration
Swift
public func hexists(_ key: String, field: String, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
field
The field.
callback
The callback function, Bool will contain true if the hash exists and contains the specified field. NSError will be non-nil if an error occurred.
-
Get the value associated with a field in the hash stored at a key.
Parameter
Parameter key: The key.Parameter
Parameter field: The field.Parameter
Parameter callback: The callback function returning the value associated with the field, or nil when field is not present in the hash or key does not exist. NSError will be non-nil if an error occurred.Declaration
Swift
public func hget(_ key: String, field: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
field
The field.
callback
The callback function returning the value associated with the field, or nil when field is not present in the hash or key does not exist. NSError will be non-nil if an error occurred.
-
Get all fields and values of the hash stored at a key.
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Dictionarycontains the field names and their associated values that are stored in the hash, it is empty if key does not exist. NSError will be non-nil if an error occurred. Declaration
Swift
public func hgetall(_ key: String, callback: ([String: RedisString], NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Dictionary
contains the field names and their associated values that are stored in the hash, it is empty if key does not exist. NSError will be non-nil if an error occurred. -
Increments the number stored in a field in the hash stored at a key by a value
Parameter
Parameter key: The key.Parameter
Parameter field: The field.Parameter
Parameter by: The value to increment by.Parameter
Parameter callback: The callback function, the Int will contain the value of the field after it was incremented. NSError will be non-nil if an error occurred.Declaration
Swift
public func hincr(_ key: String, field: String, by: Int, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
field
The field.
by
The value to increment by.
callback
The callback function, the Int will contain the value of the field after it was incremented. NSError will be non-nil if an error occurred.
-
Increments the number stored in a field in the hash stored at a key by floating point value
Parameter
Parameter key: The key.Parameter
Parameter field: The field.Parameter
Parameter byFloat: The floating point value to increment by.Parameter
Parameter callback: The callback function, theRedisString
will contain the value of the field after it was incremented. NSError will be non-nil if an error occurred.Declaration
Swift
public func hincr(_ key: String, field: String, byFloat: Float, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
field
The field.
byFloat
The floating point value to increment by.
callback
The callback function, the
RedisString
will contain the value of the field after it was incremented. NSError will be non-nil if an error occurred. -
Get all of the field names in the hash stored at a key
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Arraywill contain the list of the fields names in the hash. NSError will be non-nil if an error occurred. Declaration
Swift
public func hkeys(_ key: String, callback: ([String]?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Array
will contain the list of the fields names in the hash. NSError will be non-nil if an error occurred. -
Get the number of fields contained in the hash stored at a key
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Int will contain the number of fields in the hash, or 0 when the key does not exist. NSError will be non-nil if an error occurred.Declaration
Swift
public func hlen(_ key: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Int will contain the number of fields in the hash, or 0 when the key does not exist. NSError will be non-nil if an error occurred.
-
Get the values associated with the specified fields in the hash stored at a key.
Parameter
Parameter key: The key.Parameter
Parameter fields: The list of field names.Parameter
Parameter callback: The callback function, the Arraywill contain the list of values associated with the given fields, in the order the field names were specified. NSError will be non-nil if an error occurred. Declaration
Swift
public func hmget(_ key: String, fields: String..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
fields
The list of field names.
callback
The callback function, the Array
will contain the list of values associated with the given fields, in the order the field names were specified. NSError will be non-nil if an error occurred. -
Sets the specified fields to their respective values in the hash stored at key. This command overwrites any existing fields in the hash. If the key does not exist, a new key holding a hash is created.
Parameter
Parameter key: The key.Parameter
Parameter fieldValuePairs: The list of field name value tuples to set.Parameter
Parameter callback: The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func hmset(_ key: String, fieldValuePairs: (String, String)..., callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
fieldValuePairs
The list of field name value tuples to set.
callback
The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.
-
Sets the specified fields to their respective values in the hash stored at key. This command overwrites any existing fields in the hash. If key does not exist, a new key holding a hash is created.
Parameter
Parameter key: The key.Parameter
Parameter fieldValuePairs: The array of field name value tuples to set.Parameter
Parameter callback: The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func hmsetArrayOfKeyValues(_ key: String, fieldValuePairs: [(String, String)], callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
fieldValuePairs
The array of field name value tuples to set.
callback
The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.
-
Sets the specified fields to their respective values in the hash stored at key. This command overwrites any existing fields in the hash. If key does not exist, a new key holding a hash is created.
Parameter
Parameter key: The key.Parameter
Parameter fieldValuePairs: The list of field name value tuples to set. With values asRedisString
s.Parameter
Parameter callback: The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func hmset(_ key: String, fieldValuePairs: (String, RedisString)..., callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
fieldValuePairs
The list of field name value tuples to set. With values as
RedisString
s.callback
The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.
-
Sets the specified fields to their respective values in the hash stored at key. This command overwrites any existing fields in the hash. If key does not exist, a new key holding a hash is created.
Parameter
Parameter key: The key.Parameter
Parameter fieldValuePairs: The array of field name value tuples to set. With values asRedisString
s.Parameter
Parameter callback: The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.Declaration
Swift
public func hmsetArrayOfKeyValues(_ key: String, fieldValuePairs: [(String, RedisString)], callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
fieldValuePairs
The array of field name value tuples to set. With values as
RedisString
s.callback
The callback function, the Bool will contain true if the fields were set. NSError will be non-nil if an error occurred.
-
Sets the specified field in a hash stored at a key to a value. This command overwrites an existing field in the hash. If key does not exist, a new key holding a hash is created.
Parameter
Parameter key: The key.Parameter
Parameter field: The name of the field name to set.Parameter
Parameter value: The value to set the field to.Parameter
Parameter exists: If true, will set the value only if the field exists.Parameter
Parameter callback: The callback function, the Bool will contain true if the field was set. NSError will be non-nil if an error occurred.Declaration
Swift
public func hset(_ key: String, field: String, value: String, exists: Bool=true, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
field
The name of the field name to set.
value
The value to set the field to.
exists
If true, will set the value only if the field exists.
callback
The callback function, the Bool will contain true if the field was set. NSError will be non-nil if an error occurred.
-
Sets the specified field in a hash stored at a key to a value. This command overwrites an existing field in the hash. If key does not exist, a new key holding a hash is created.
Parameter
Parameter key: The key.Parameter
Parameter field: The name of the field name to set.Parameter
Parameter value: The value in the form of aRedisString
to set the field to.Parameter
Parameter exists: If true, will set the value only if the field existsParameter
Parameter callback: The callback function, the Bool will contain true if the field was set. NSError will be non-nil if an error occurred.Declaration
Swift
public func hset(_ key: String, field: String, value: RedisString, exists: Bool=true, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
field
The name of the field name to set.
value
The value in the form of a
RedisString
to set the field to.exists
If true, will set the value only if the field exists
callback
The callback function, the Bool will contain true if the field was set. NSError will be non-nil if an error occurred.
-
Get the string length of the value in a field in a hash stored at a key. If the key or the field do not exist, 0 is returned.
Parameter
Parameter key: The key.Parameter
Parameter field: The name of the field.Parameter
Parameter callback: The callback function, the Int will contain the string length of the value in the specified field. NSError will be non-nil if an error occurred.Declaration
Swift
public func hstrlen(_ key: String, field: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
field
The name of the field.
callback
The callback function, the Int will contain the string length of the value in the specified field. NSError will be non-nil if an error occurred.
-
Get all of the values in the hash stored at a key.
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Arraywill contain the list of values in the hash. NSError will be non-nil if an error occurred. Declaration
Swift
public func hvals(_ key: String, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Array
will contain the list of values in the hash. NSError will be non-nil if an error occurred.
-
Retrieve an element from one of many lists, potentially blocking until one of the lists has an element
Parameter
Parameter keys: The keys of the lists to check for an element.Parameter
Parameter timeout: The amount of time to wait or zero to wait forever.Parameter
Parameter callback: The callback function, when a time out didn’t occur, the Arraywill contain two entries, the first one is the key of the list that had an element and the second entry is the value of that element. NSError will be non-nil if an error occurred. Declaration
Swift
public func blpop(_ keys: String..., timeout: TimeInterval, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The keys of the lists to check for an element.
timeout
The amount of time to wait or zero to wait forever.
callback
The callback function, when a time out didn’t occur, the Array
will contain two entries, the first one is the key of the list that had an element and the second entry is the value of that element. NSError will be non-nil if an error occurred. -
Retrieve an element from the end of one of many lists, potentially blocking until one of the lists has an element
Parameter
Parameter keys: The keys of the lists to check for an element.Parameter
Parameter timeout: The amount of time to wait or zero to wait forever.Parameter
Parameter callback: The callback function, when a time out didn’t occur, the Arraywill contain two entries, the first one is the key of the list that had an element and the second entry is the value of that element. NSError will be non-nil if an error occurred. Declaration
Swift
public func brpop(_ keys: String..., timeout: TimeInterval, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The keys of the lists to check for an element.
timeout
The amount of time to wait or zero to wait forever.
callback
The callback function, when a time out didn’t occur, the Array
will contain two entries, the first one is the key of the list that had an element and the second entry is the value of that element. NSError will be non-nil if an error occurred. -
Remove and return the last value of a list and push it onto another list, blocking until there is an element to pop
Parameter
Parameter source: The list to pop an item from.Parameter
Parameter destination: The list to push the poped item onto.Parameter
Parameter timeout: The amount of time to wait or zero to wait forever.Parameter
Parameter callback: The callback function, when a time out didn’t occur, theRedisString
will contain the value of the element that was poped. NSError will be non-nil if an error occurred.Declaration
Swift
public func brpoplpush(_ source: String, destination: String, timeout: TimeInterval, callback: (RedisString?, NSError?) -> Void)
Parameters
source
The list to pop an item from.
destination
The list to push the poped item onto.
timeout
The amount of time to wait or zero to wait forever.
callback
The callback function, when a time out didn’t occur, the
RedisString
will contain the value of the element that was poped. NSError will be non-nil if an error occurred. -
Retrieve an element from a list by index
Parameter
Parameter key: The key.Parameter
Parameter index: The index of the element to retrieve.Parameter
Parameter callback: The callback function, theRedisString
will contain the value of the element at the index. NSError will be non-nil if an error occurred.Declaration
Swift
public func lindex(_ key: String, index: Int, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
index
The index of the element to retrieve.
callback
The callback function, the
RedisString
will contain the value of the element at the index. NSError will be non-nil if an error occurred. -
Insert a value into a list before or after a pivot
Parameter
Parameter key: The key.Parameter
Parameter before: If true, the value is inserted before the pivot.Parameter
Parameter pivot: The pivot around which the value will be inserted.Parameter
Parameter value: The value to be inserted.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after the insert or -1 if the pivot wasn’t found. NSError will be non-nil if an error occurred.Declaration
Swift
public func linsert(_ key: String, before: Bool, pivot: String, value: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
before
If true, the value is inserted before the pivot.
pivot
The pivot around which the value will be inserted.
value
The value to be inserted.
callback
The callback function, the Int will contain the length of the list after the insert or -1 if the pivot wasn’t found. NSError will be non-nil if an error occurred.
-
Insert a value into a list before or after a pivot
Parameter
Parameter key: The key.Parameter
Parameter before: If true, the value is inserted before the pivot.Parameter
Parameter pivot: The pivot, in the form of aRedisString
, around which the value will be inserted.Parameter
Parameter value: The value, in the form of aRedisString
, to be inserted.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after the insert or -1 if the pivot wasn’t found. NSError will be non-nil if an error occurred.Declaration
Swift
public func linsert(_ key: String, before: Bool, pivot: RedisString, value: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
before
If true, the value is inserted before the pivot.
pivot
The pivot, in the form of a
RedisString
, around which the value will be inserted.value
The value, in the form of a
RedisString
, to be inserted.callback
The callback function, the Int will contain the length of the list after the insert or -1 if the pivot wasn’t found. NSError will be non-nil if an error occurred.
-
Get the length of a list
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Int will contain the length of the list. NSError will be non-nil if an error occurred.Declaration
Swift
public func llen(_ key: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Int will contain the length of the list. NSError will be non-nil if an error occurred.
-
Pop a value from a list
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the RedisString will contain the value poped from the list. NSError will be non-nil if an error occurred.Declaration
Swift
public func lpop(_ key: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the RedisString will contain the value poped from the list. NSError will be non-nil if an error occurred.
-
Push a set of values on to a list
Parameter
Parameter key: The key.Parameter
Parameter values: The set of the values to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func lpush(_ key: String, values: String..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The set of the values to be pushed on to the list.
callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Push a set of values on to a list
Parameter
Parameter key: The key.Parameter
Parameter values: An array of values to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func lpushArrayOfValues(_ key: String, values: [String], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
An array of values to be pushed on to the list.
callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Push a set of values on to a list
Parameter
Parameter key: The key.Parameter
Parameter values: The set of values, in the form ofRedisString
s, to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func lpush(_ key: String, values: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The set of values, in the form of
RedisString
s, to be pushed on to the list.callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Push a set of values on to a list
Parameter
Parameter key: The key.Parameter
Parameter values: The array of the values, in the form ofRedisString
s, to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func lpushArrayOfValues(_ key: String, values: [RedisString], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The array of the values, in the form of
RedisString
s, to be pushed on to the list.callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Push a value on to a list, only if the list exists
Parameter
Parameter key: The key.Parameter
Parameter value: The value to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func lpushx(_ key: String, value: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
value
The value to be pushed on to the list.
callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Push a value on to a list, only if the list exists
Parameter
Parameter key: The key.Parameter
Parameter values: The value, in the form ofRedisString
, to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func lpushx(_ key: String, value: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The value, in the form of
RedisString
, to be pushed on to the list.callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Retrieve a group of elements from a list as specified by a range
Parameter
Parameter key: The key.Parameter
Parameter start: The index to start retrieving from.Parameter
Parameter end: The index to stop retrieving at.Parameter
Parameter callback: The callback function, the Arraywill contain the group of elements retrieved. NSError will be non-nil if an error occurred. Declaration
Swift
public func lrange(_ key: String, start: Int, end: Int, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
start
The index to start retrieving from.
end
The index to stop retrieving at.
callback
The callback function, the Array
will contain the group of elements retrieved. NSError will be non-nil if an error occurred. -
Remove a number of elements that match the supplied value from the list
Parameter
Parameter key: The key.Parameter
Parameter count: The number of elements to remove.Parameter
Parameter value: The value of the elements to remove.Parameter
Parameter callback: The callback function, the Int will contain the number of elements that were removed. NSError will be non-nil if an error occurred.Declaration
Swift
public func lrem(_ key: String, count: Int, value: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
count
The number of elements to remove.
value
The value of the elements to remove.
callback
The callback function, the Int will contain the number of elements that were removed. NSError will be non-nil if an error occurred.
-
Remove a number of elements that match the supplied value from the list
Parameter
Parameter key: The key.Parameter
Parameter count: The number of elements to remove.Parameter
Parameter value: The value of the elemnts to remove in the form of aRedisString
.Parameter
Parameter callback: The callback function, the Int will contain the number of elements that were removed. NSError will be non-nil if an error occurred.Declaration
Swift
public func lrem(_ key: String, count: Int, value: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
count
The number of elements to remove.
value
The value of the elemnts to remove in the form of a
RedisString
.callback
The callback function, the Int will contain the number of elements that were removed. NSError will be non-nil if an error occurred.
-
Set a value in a list to a new value
Parameter
Parameter key: The key.Parameter
Parameter index: The index of the value in the list to be updated.Parameter
Parameter value: The new value for the element of the list.Parameter
Parameter callback: The callback function, the Bool will contain true if the list element was updated. NSError will be non-nil if an error occurred.Declaration
Swift
public func lset(_ key: String, index: Int, value: String, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
index
The index of the value in the list to be updated.
value
The new value for the element of the list.
callback
The callback function, the Bool will contain true if the list element was updated. NSError will be non-nil if an error occurred.
-
Set a value in a list to a new value
Parameter
Parameter key: The key.Parameter
Parameter index: The index of the value in the list to be updated.Parameter
Parameter value: The new value for the element of the list in the form of aRedisString
.Parameter
Parameter callback: The callback function, the Bool will contain true if the list element was updated. NSError will be non-nil if an error occurred.Declaration
Swift
public func lset(_ key: String, index: Int, value: RedisString, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
index
The index of the value in the list to be updated.
value
The new value for the element of the list in the form of a
RedisString
.callback
The callback function, the Bool will contain true if the list element was updated. NSError will be non-nil if an error occurred.
-
Trim a list to a new size
Parameter
Parameter key: The key.Parameter
Parameter start: The index of the first element of the list to keep.Parameter
Parameter end: The index of the last element of the list to keep.Parameter
Parameter callback: The callback function, the Bool will contain true if the list was trimmed. NSError will be non-nil if an error occurred.Declaration
Swift
public func ltrim(_ key: String, start: Int, end: Int, callback: (Bool, NSError?) -> Void)
Parameters
key
The key.
start
The index of the first element of the list to keep.
end
The index of the last element of the list to keep.
callback
The callback function, the Bool will contain true if the list was trimmed. NSError will be non-nil if an error occurred.
-
Remove and return the last value of a list
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the RedisString will contain the value poped from the list. NSError will be non-nil if an error occurred.Declaration
Swift
public func rpop(_ key: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the RedisString will contain the value poped from the list. NSError will be non-nil if an error occurred.
-
Remove and return the last value of a list and push it onto the front of another list
Parameter
Parameter source: The list to pop an item from.Parameter
Parameter destination: The list to push the poped item onto.Parameter
Parameter callback: The callback function, the RedisString will contain the value poped from the source list. NSError will be non-nil if an error occurred.Declaration
Swift
public func rpoplpush(_ source: String, destination: String, callback: (RedisString?, NSError?) -> Void)
Parameters
source
The list to pop an item from.
destination
The list to push the poped item onto.
callback
The callback function, the RedisString will contain the value poped from the source list. NSError will be non-nil if an error occurred.
-
Append a set of values to end of a list
Parameter
Parameter key: The key.Parameter
Parameter values: The list of values to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func rpush(_ key: String, values: String..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The list of values to be pushed on to the list.
callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Append a set of values to a list
Parameter
Parameter key: The key.Parameter
Parameter values: An array of values to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func rpushArrayOfValues(_ key: String, values: [String], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
An array of values to be pushed on to the list.
callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Append a set of values to a list
Parameter
Parameter key: The key.Parameter
Parameter values: The list ofRedisString
values to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func rpush(_ key: String, values: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The list of
RedisString
values to be pushed on to the list.callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Append a set of values to a list
Parameter
Parameter key: The key.Parameter
Parameter values: An array ofRedisString
values to be pushed on to the listDeclaration
Swift
public func rpushArrayOfValues(_ key: String, values: [RedisString], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
An array of
RedisString
values to be pushed on to the list -
Append a value to a list, only if the list exists
Parameter
Parameter key: The key.Parameter
Parameter values: The value to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func rpushx(_ key: String, value: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The value to be pushed on to the list.
callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Append a value to a list, only if the list exists
Parameter
Parameter key: The key.Parameter
Parameter values: TheRedisString
value to be pushed on to the list.Parameter
Parameter callback: The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.Declaration
Swift
public func rpushx(_ key: String, value: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
values
The
RedisString
value to be pushed on to the list.callback
The callback function, the Int will contain the length of the list after push. NSError will be non-nil if an error occurred.
-
Add one or more members to a set
Parameter
Parameter key: The key.Parameter
Parameter members: The values to be added to the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sadd(_ key: String, members: String..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
The values to be added to the set.
callback
The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.
-
Add one or more members to a set
Parameter
Parameter key: The key.Parameter
Parameter members: An array of values to be added to the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func saddArrayOfMembers(_ key: String, members: [String], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
An array of values to be added to the set.
callback
The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.
-
Add one or more members to a set
Parameter
Parameter key: The key.Parameter
Parameter members: TheRedisString
values to be added to the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sadd(_ key: RedisString, members: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
The
RedisString
values to be added to the set.callback
The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.
-
Add one or more members to a set
Parameter
Parameter key: The key.Parameter
Parameter members: An array ofRedisString
values to be added to the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func saddArrayOfMembers(_ key: RedisString, members: [RedisString], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
An array of
RedisString
values to be added to the set.callback
The callback function, the Int will contain the number of elements that were added to the set. NSError will be non-nil if an error occurred.
-
Get the number of members in a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Int will contain the cardinality (number of elements) of the set, or 0 if key does not exist. NSError will be non-nil if an error occurred.Declaration
Swift
public func scard(_ key: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Int will contain the cardinality (number of elements) of the set, or 0 if key does not exist. NSError will be non-nil if an error occurred.
-
Get the number of members in a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Int will contain the cardinality (number of elements) of the set, or 0 if key does not exist. NSError will be non-nil if an error occurred.Declaration
Swift
public func scard(_ key: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Int will contain the cardinality (number of elements) of the set, or 0 if key does not exist. NSError will be non-nil if an error occurred.
-
Subtract multiple sets
Parameter
Parameter keys: The list of keys to get the difference from.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sdiff(keys: String..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of keys to get the difference from.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Subtract multiple sets
Parameter
Parameter keys: An array of the keys to get the difference from.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sdiffArrayOfKeys(keys: [String], callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
An array of the keys to get the difference from.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Subtract multiple sets
Parameter
Parameter keys: The list of the keys to get the difference from.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sdiff(keys: RedisString..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of the keys to get the difference from.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Subtract multiple sets
Parameter
Parameter keys: An array of the keys to get the difference from.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sdiffArrayOfKeys(keys: [RedisString], callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
An array of the keys to get the difference from.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Subtract multiple sets and store the resulting set in a key
Parameter
Parameter destination: The destination of the result, if the destination already exists, it is overwrittenParameter
Parameter keys: The list of the keys to get the difference from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sdiffstore(destination: String, keys: String..., callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the result, if the destination already exists, it is overwritten
keys
The list of the keys to get the difference from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Subtract multiple sets and store the resulting set in a key
Parameter
Parameter destination: The destination of the result.Parameter
Parameter keys: An array of the keys to get the difference from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sdiffstoreArrayOfKeys(destination: String, keys: [String], callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the result.
keys
An array of the keys to get the difference from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Subtract multiple sets and store the resulting set in a key
Parameter
Parameter destination: The destination of the result, if the destination already exists, it is overwrittenParameter
Parameter keys: The list of the keys to get the difference from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sdiffstore(destination: RedisString, keys: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the result, if the destination already exists, it is overwritten
keys
The list of the keys to get the difference from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Subtract multiple sets and store the resulting set in a key
Parameter
Parameter destination: Tthe destination of the result.Parameter
Parameter keys: An array of keys to get the difference from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sdiffstoreArrayOfKeys(destination: RedisString, keys: [RedisString], callback: (Int?, NSError?) -> Void)
Parameters
destination
Tthe destination of the result.
keys
An array of keys to get the difference from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Get all the members in a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Arraywill contain the elements in the set. NSError will be non-nil if an error occurred. Declaration
Swift
public func smembers(_ key: String, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Array
will contain the elements in the set. NSError will be non-nil if an error occurred. -
Get all the members in a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Arraywill contain the elements in the set. NSError will be non-nil if an error occurred. Declaration
Swift
public func smembers(_ key: RedisString, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Array
will contain the elements in the set. NSError will be non-nil if an error occurred. -
Intersect multiple sets
Parameter
Parameter keys: The list of the keys to intersect from.Parameter
Parameter callback: The callback function, the Arraywill contain the elements of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sinter(_ keys: String..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of the keys to intersect from.
callback
The callback function, the Array
will contain the elements of the resulting set. NSError will be non-nil if an error occurred. -
Intersect multiple sets
Parameter
Parameter keys: An array of the keys to intersect from.Parameter
Parameter callback: The callback function, the Arraywill contain the elements of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sinterArrayOfKeys(_ keys: [String], callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
An array of the keys to intersect from.
callback
The callback function, the Array
will contain the elements of the resulting set. NSError will be non-nil if an error occurred. -
Intersect multiple sets
Parameter
Parameter keys: The list of the keys to intersect from.Parameter
Parameter callback: The callback function, the Arraywill contain the elements of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sinter(_ keys: RedisString..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of the keys to intersect from.
callback
The callback function, the Array
will contain the elements of the resulting set. NSError will be non-nil if an error occurred. -
Intersect multiple sets
Parameter
Parameter keys: An array of the keys to intersect from.Parameter
Parameter callback: The callback function, the Arraywill contain the elements of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sinterArrayOfKeys(_ keys: [RedisString], callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
An array of the keys to intersect from.
callback
The callback function, the Array
will contain the elements of the resulting set. NSError will be non-nil if an error occurred. -
Intersect multiple sets and store the resulting set in a key
Parameter
Parameter destination: The destination of the result.Parameter
Parameter keys: The list of the keys to intersect from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sinterstore(_ destination: String, keys: String..., callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the result.
keys
The list of the keys to intersect from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Intersect multiple sets and store the resulting set in a key
Parameter
Parameter destination: The destination of the result.Parameter
Parameter keys: An array of the keys to intersect from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sinterstoreArrayOfKeys(_ destination: String, keys: [String], callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the result.
keys
An array of the keys to intersect from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Intersect multiple sets and store the resulting set in a key
Parameter
Parameter destination: The destination of the result.Parameter
Parameter keys: The list of the keys to intersect from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sinterstore(_ destination: RedisString, keys: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the result.
keys
The list of the keys to intersect from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Intersect multiple sets and store the resulting set in a key
Parameter
Parameter destination: The destination of the result.Parameter
Parameter keys: An array of the keys to intersect from.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sinterstoreArrayOfKeys(_ destination: RedisString, keys: [RedisString], callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the result.
keys
An array of the keys to intersect from.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Determine if a given value is a member of a set
Parameter
Parameter key: The key.Parameter
Parameter member: The String parameter for the member.Parameter
Parameter callback: The callback function, the Bool will contain true if the member is an element of the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sismember(_ key: String, member: String, callback: (Bool?, NSError?) -> Void)
Parameters
key
The key.
member
The String parameter for the member.
callback
The callback function, the Bool will contain true if the member is an element of the set. NSError will be non-nil if an error occurred.
-
Determine if a given value is a member of a set
Parameter
Parameter key: The key.Parameter
Parameter member: TheRedisString
parameter for the member.Parameter
Parameter callback: The callback function, the Bool will contain true if the member is an element of the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sismember(_ key: RedisString, member: RedisString, callback: (Bool?, NSError?) -> Void)
Parameters
key
The key.
member
The
RedisString
parameter for the member.callback
The callback function, the Bool will contain true if the member is an element of the set. NSError will be non-nil if an error occurred.
-
Move a member from one set to another
Parameter
Parameter source: The Source set from where to move the member from.Parameter
Parameter destination: The Destination set from where to move the member to.Parameter
Parameter member: The String parameter for the member to be moved.Parameter
Parameter callback: The callback function, the Bool will contain true if the member was moved. NSError will be non-nil if an error occurred.Declaration
Swift
public func smove(source: String, destination: String, member: String, callback: (Bool?, NSError?) -> Void)
Parameters
source
The Source set from where to move the member from.
destination
The Destination set from where to move the member to.
member
The String parameter for the member to be moved.
callback
The callback function, the Bool will contain true if the member was moved. NSError will be non-nil if an error occurred.
-
Move a member from one set to another
Parameter
Parameter source: The Source set from where to move the member from.Parameter
Parameter destination: The Destination set from where to move the member to.Parameter
Parameter member: The RedisString parameter for the member to be moved.Parameter
Parameter callback: The callback function, the Bool will contain true if the member was moved. NSError will be non-nil if an error occurred.Declaration
Swift
public func smove(source: RedisString, destination: RedisString, member: RedisString, callback: (Bool?, NSError?) -> Void)
Parameters
source
The Source set from where to move the member from.
destination
The Destination set from where to move the member to.
member
The RedisString parameter for the member to be moved.
callback
The callback function, the Bool will contain true if the member was moved. NSError will be non-nil if an error occurred.
-
Remove and return a random member from a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, theRedisString
will contain the removed member of the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func spop(_ key: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the
RedisString
will contain the removed member of the set. NSError will be non-nil if an error occurred. -
Remove and return one or multiple random members from a set
Parameter
Parameter key: The key.Parameter
Parameter count: The number of members to pop.Parameter
Parameter callback: The callback function, the Arraywill contain the removed members of the set. NSError will be non-nil if an error occurred. Declaration
Swift
public func spop(_ key: String, count: Int, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
count
The number of members to pop.
callback
The callback function, the Array
will contain the removed members of the set. NSError will be non-nil if an error occurred. -
Remove and return a random member from a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, theRedisString
will contain the removed member of the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func spop(_ key: RedisString, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the
RedisString
will contain the removed member of the set. NSError will be non-nil if an error occurred. -
Remove and return one or multiple random members from a set
Parameter
Parameter key: The key.Parameter
Parameter count: The number of members to pop.Parameter
Parameter callback: The callback function, the Arraywill contain the removed members of the set. NSError will be non-nil if an error occurred. Declaration
Swift
public func spop(_ key: RedisString, count: Int, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
count
The number of members to pop.
callback
The callback function, the Array
will contain the removed members of the set. NSError will be non-nil if an error occurred. -
Get a random member from a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, theRedisString
will contain the member of the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func srandmember(_ key: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the
RedisString
will contain the member of the set. NSError will be non-nil if an error occurred. -
Get one or multiple random members from a set
Parameter
Parameter key: The key.Parameter
Parameter count: The number of members to return.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the set. NSError will be non-nil if an error occurred. Declaration
Swift
public func srandmember(_ key: String, count: Int, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
count
The number of members to return.
callback
The callback function, the Array
will contain the members of the set. NSError will be non-nil if an error occurred. -
Get a random member from a set
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, theRedisString
will contain the member of the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func srandmember(_ key: RedisString, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the
RedisString
will contain the member of the set. NSError will be non-nil if an error occurred. -
Get one or multiple random members from a set
Parameter
Parameter key: The key.Parameter
Parameter count: The number of members to return.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the set. NSError will be non-nil if an error occurred. Declaration
Swift
public func srandmember(_ key: RedisString, count: Int, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
count
The number of members to return.
callback
The callback function, the Array
will contain the members of the set. NSError will be non-nil if an error occurred. -
Remove one or more members from a set
Parameter
Parameter key: The key.Parameter
Parameter members: The list of the members to be removed.Parameter
Parameter callback: The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func srem(_ key: String, members: String..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
The list of the members to be removed.
callback
The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.
-
Remove one or more members from a set
Parameter
Parameter key: The key.Parameter
Parameter members: An Array of the members to be removed.Parameter
Parameter callback: The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sremArrayOfMembers(_ key: String, members: [String], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
An Array of the members to be removed.
callback
The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.
-
Remove one or more members from a set
Parameter
Parameter key: The key.Parameter
Parameter members: The list of the members to be removed.Parameter
Parameter callback: The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func srem(_ key: RedisString, members: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
The list of the members to be removed.
callback
The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.
-
Remove one or more members from a set
Parameter
Parameter key: The key.Parameter
Parameter members: An array of the members to be removed.Parameter
Parameter callback: The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sremArrayOfMembers(_ key: RedisString, members: [RedisString], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
An array of the members to be removed.
callback
The callback function, the Int will contain the number of members that were removed from the set. NSError will be non-nil if an error occurred.
-
Add multiple sets
Parameter
Parameter keys: The list of the keys to union.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sunion(_ keys: String..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of the keys to union.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Add multiple sets
Parameter
Parameter keys: An array of the keys to union.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sunionArrayOfKeys(_ keys: [String], callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
An array of the keys to union.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Add multiple sets
Parameter
Parameter keys: The list of the keys to union.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sunion(_ keys: RedisString..., callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of the keys to union.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Add multiple sets
Parameter
Parameter keys: The list of the keys to union.Parameter
Parameter callback: The callback function, the Arraywill contain the members of the resulting set. NSError will be non-nil if an error occurred. Declaration
Swift
public func sunionArrayOfKeys(_ keys: [RedisString], callback: ([RedisString?]?, NSError?) -> Void)
Parameters
keys
The list of the keys to union.
callback
The callback function, the Array
will contain the members of the resulting set. NSError will be non-nil if an error occurred. -
Add multiple sets
Parameter
Parameter destination: The destination of the resulting set, if the destination already exists, it is overwritten.Parameter
Parameter keys: The list of the keys to union.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sunionstore(_ destination: String, keys: String..., callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the resulting set, if the destination already exists, it is overwritten.
keys
The list of the keys to union.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Add multiple sets
Parameter
Parameter destination: The destination of the resulting set, if the destination already exists, it is overwritten.Parameter
Parameter keys: The list of the keys to union.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sunionstoreArrayOfKeys(_ destination: String, keys: [String], callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the resulting set, if the destination already exists, it is overwritten.
keys
The list of the keys to union.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Add multiple sets
Parameter
Parameter destination: The destination of the resulting set, if the destination already exists, it is overwritten.Parameter
Parameter keys: The list of the keys to union.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sunionstore(_ destination: RedisString, keys: RedisString..., callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the resulting set, if the destination already exists, it is overwritten.
keys
The list of the keys to union.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Add multiple sets
Parameter
Parameter destination: The destination of the resulting set, if the destination already exists, it is overwritten.Parameter
Parameter keys: The list of the keys to union.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.Declaration
Swift
public func sunionstoreArrayOfKeys(_ destination: RedisString, keys: [RedisString], callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination of the resulting set, if the destination already exists, it is overwritten.
keys
The list of the keys to union.
callback
The callback function, the Int will contain the number of elements in the resulting set. NSError will be non-nil if an error occurred.
-
Iterates elements of Sets types.
Parameter
Parameter key: The key.Parameter
Parameter cursor: iteratorParameter
Parameter match: glob-style patternParameter
Parameter callback: The callback function, theRedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred. Declaration
Swift
public func sscan(_ key: String, cursor: Int, match: String? = nil, count: Int? = nil, callback: (RedisString?, [RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
cursor
iterator
match
glob-style pattern
count
The amount of work that should be done at every call in order to retrieve elements from the collection.
callback
The callback function, the
RedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred. -
Iterates elements of Sets types.
Parameter
Parameter key: The key.Parameter
Parameter cursor: iteratorParameter
Parameter match: glob-style patternParameter
Parameter callback: The callback function, theRedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred. Declaration
Swift
public func sscan(_ key: RedisString, cursor: Int, match: RedisString? = nil, count: Int? = nil, callback: (RedisString?, [RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
cursor
iterator
match
glob-style pattern
count
The amount of work that should be done at every call in order to retrieve elements from the collection.
callback
The callback function, the
RedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred.
-
Add elements to a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter tuples: A list of tuples containing a score and value to be added to the sorted set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zadd(_ key: String, tuples: (Int, String)..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
tuples
A list of tuples containing a score and value to be added to the sorted set.
callback
The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.
-
Add elements to a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter tuples: A list of tuples containing a score and value to be added to the sorted set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zadd(_ key: String, tuples: (Int, RedisString)..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
tuples
A list of tuples containing a score and value to be added to the sorted set.
callback
The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.
-
Add elements to a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter tuples: An array of tuples containing a score and value to be added to the sorted set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zaddArrayOfScoreMembers(_ key: String, tuples: [(Int, String)], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
tuples
An array of tuples containing a score and value to be added to the sorted set.
callback
The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.
-
Add elements to a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter tuples: An array of tuples containing a score and value to be added to the sorted set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zaddArrayOfScoreMembers(_ key: String, tuples: [(Int, RedisString)], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
tuples
An array of tuples containing a score and value to be added to the sorted set.
callback
The callback function, the Int will contain the number of elements added to the sorted set. NSError will be non-nil if an error occurred.
-
Get the sorted set’s cardinality (number of elements).
Parameter
Parameter key: The key.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zcard(_ key: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
callback
The callback function, the Int will contain the number of elements in the sorted set. NSError will be non-nil if an error occurred.
-
Count the members in a sorted set with scores within the given values.
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to count from the set.Parameter
Parameter max: The maximum score to count from the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the specified score range. NSError will be non-nil if an error occurred.Declaration
Swift
public func zcount(_ key: String, min: String, max: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to count from the set.
max
The maximum score to count from the set.
callback
The callback function, the Int will contain the number of elements in the specified score range. NSError will be non-nil if an error occurred.
-
Count the members in a sorted set with scores within the given values.
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to count from the set.Parameter
Parameter max: The maximum score to count from the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the specified score range. NSError will be non-nil if an error occurred.Declaration
Swift
public func zcount(_ key: RedisString, min: RedisString, max: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to count from the set.
max
The maximum score to count from the set.
callback
The callback function, the Int will contain the number of elements in the specified score range. NSError will be non-nil if an error occurred.
-
Increment the score of a member in a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter increment: The amount to increment the member by.Parameter
Parameter member: The member to increment.Parameter
Parameter callback: The callback function, the String will contain the new score of member. NSError will be non-nil if an error occurred.Declaration
Swift
public func zincrby(_ key: String, increment: Int, member: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
increment
The amount to increment the member by.
member
The member to increment.
callback
The callback function, the String will contain the new score of member. NSError will be non-nil if an error occurred.
-
Increment the score of a member in a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter increment: The amount to increment the member by.Parameter
Parameter member: The member to increment.Parameter
Parameter callback: The callback function, the String will contain the new score of member. NSError will be non-nil if an error occurred.Declaration
Swift
public func zincrby(_ key: String, increment: Int, member: RedisString, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
increment
The amount to increment the member by.
member
The member to increment.
callback
The callback function, the String will contain the new score of member. NSError will be non-nil if an error occurred.
-
Intersect multiple sorted sets and store the resulting sorted set in a new key.
Parameter
Parameter destination: The stored set where the results will be saved to. If destination exists, it will be overwritten.Parameter
Parameter numkeys: The number of keys to be sorted.Parameter
Parameter keys: The keys to be intersected.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.Declaration
Swift
public func zinterstore(_ destination: String, numkeys: Int, keys: String..., weights: [Int] = [], aggregate: String = "", callback: (Int?, NSError?) -> Void)
Parameters
destination
The stored set where the results will be saved to. If destination exists, it will be overwritten.
numkeys
The number of keys to be sorted.
keys
The keys to be intersected.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.
-
Intersect multiple sorted sets and store the resulting sorted set in a new key.
Parameter
Parameter destination: The stored set where the results will be saved to. If destination exists, it will be overwritten.Parameter
Parameter numkeys: The number of keys to be sorted.Parameter
Parameter keys: The keys to be intersected.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.Declaration
Swift
public func zinterstoreInArray(_ destination: String, numkeys: Int, keys: [String], weights: [Int], aggregate: String, callback: (Int?, NSError?) -> Void)
Parameters
destination
The stored set where the results will be saved to. If destination exists, it will be overwritten.
numkeys
The number of keys to be sorted.
keys
The keys to be intersected.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.
-
Intersect multiple sorted sets and store the resulting sorted set in a new key.
Parameter
Parameter destination: The stored set where the results will be saved to. If destination exists, it will be overwritten.Parameter
Parameter numkeys: The number of keys to be sorted.Parameter
Parameter keys: The keys to be intersected.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.Declaration
Swift
public func zinterstore(_ destination: String, numkeys: Int, keys: RedisString..., weights: [Int] = [], aggregate: RedisString = RedisString(""), callback: (Int?, NSError?) -> Void)
Parameters
destination
The stored set where the results will be saved to. If destination exists, it will be overwritten.
numkeys
The number of keys to be sorted.
keys
The keys to be intersected.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.
-
Intersect multiple sorted sets and store the resulting sorted set in a new key.
Parameter
Parameter destination: The stored set where the results will be saved to. If destination exists, it will be overwritten.Parameter
Parameter numkeys: The number of keys to be sorted.Parameter
Parameter keys: The keys to be intersected.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.Declaration
Swift
public func zinterstoreInArray(_ destination: String, numkeys: Int, keys: [RedisString], weights: [Int], aggregate: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
destination
The stored set where the results will be saved to. If destination exists, it will be overwritten.
numkeys
The number of keys to be sorted.
keys
The keys to be intersected.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occurred.
-
Count the number of members in a sorted set between a given lexicographical range.
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to count from the set.Parameter
Parameter max: The maximum score to count from the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the specified score range. NSError will be non-nil if an error occurred.Declaration
Swift
public func zlexcount(_ key: String, min: String, max: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to count from the set.
max
The maximum score to count from the set.
callback
The callback function, the Int will contain the number of elements in the specified score range. NSError will be non-nil if an error occurred.
-
Get the specified range of elements in a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter start: The starting index of the elements of the sorted set to fetch.Parameter
Parameter stop: The ending index of the elements of the sorted set to fetch.Parameter
Parameter callback: The callback function, the Arraywill contain the elements fetched from the sorted set. NSError will be non-nil if an error occurred. Declaration
Swift
public func zrange(_ key: String, start: Int, stop: Int, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
start
The starting index of the elements of the sorted set to fetch.
stop
The ending index of the elements of the sorted set to fetch.
callback
The callback function, the Array
will contain the elements fetched from the sorted set. NSError will be non-nil if an error occurred. -
Return a range of members in a sorted set, by lexicographical range.
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to return from the set.Parameter
Parameter max: The maximum score to return from the set.Parameter
Parameter callback: The callback function, the Array will contain the list of elements in the specified score range. NSError will be non-nil if an error occurred.Declaration
Swift
public func zrangebylex(_ key: String, min: String, max: String, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to return from the set.
max
The maximum score to return from the set.
callback
The callback function, the Array will contain the list of elements in the specified score range. NSError will be non-nil if an error occurred.
-
Return a range of members in a sorted set, by score.
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to return from the set.Parameter
Parameter max: The maximum score to return from the set.Parameter
Parameter callback: The callback function, list of elements in the specified score range (optionally their scores) NSError will be non-nil if an error occurred.Declaration
Swift
public func zrangebyscore(_ key: String, min: String, max: String, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to return from the set.
max
The maximum score to return from the set.
callback
The callback function, list of elements in the specified score range (optionally their scores) NSError will be non-nil if an error occurred.
-
Determine the index of a member in a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter member: The member to get the rank of.Parameter
Parameter callback: The callback function, the Int will conatain the rank of the member, If member or key does not exist returns nil. NSError will be non-nil if an error occurred.Declaration
Swift
public func zrank(_ key: String, member: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
member
The member to get the rank of.
callback
The callback function, the Int will conatain the rank of the member, If member or key does not exist returns nil. NSError will be non-nil if an error occurred.
-
Determine the index of a member in a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter member: The member to get the rank of.Parameter
Parameter callback: The callback function, the Int will conatain the rank of the member, If member or key does not exist returns nil. NSError will be non-nil if an error occurred.Declaration
Swift
public func zrank(_ key: String, member: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
member
The member to get the rank of.
callback
The callback function, the Int will conatain the rank of the member, If member or key does not exist returns nil. NSError will be non-nil if an error occurred.
-
Removes the specified members from the sorted set stored at key. Non existing members are ignored. An error is returned when key exists and does not hold a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter members: The list of the member(s) to remove.Parameter
Parameter callback: The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zrem(_ key: String, members: String..., callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
The list of the member(s) to remove.
callback
The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.
-
Removes the specified members from the sorted set stored at key. Non existing members are ignored. An error is returned when key exists and does not hold a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter members: An array of the member(s) to remove.Parameter
Parameter callback: The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zremArrayOfMembers(_ key: String, members: [String], callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
members
An array of the member(s) to remove.
callback
The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.
-
Remove all members in a sorted set between the given lexicographical range.
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to remove from the set.Parameter
Parameter max: The maximum score to remove from the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zremrangebylex(_ key: String, min: String, max: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to remove from the set.
max
The maximum score to remove from the set.
callback
The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.
-
Remove all members in a sorted set within the given indexes.
Parameter
Parameter key: The key.Parameter
Parameter start: The starting index to remove from the set.Parameter
Parameter stop: The ending index to remove from the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zremrangebyrank(_ key: String, start: Int, stop: Int, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
start
The starting index to remove from the set.
stop
The ending index to remove from the set.
callback
The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.
-
Removes all elements in the sorted set stored at key with a score between a minimum and a maximum (inclusive).
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to remove from the set.Parameter
Parameter max: The maximum score to remove from the set.Parameter
Parameter callback: The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.Declaration
Swift
public func zremrangebyscore(_ key: String, min: String, max: String, callback: (_ nElements: Int?, _ error: NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to remove from the set.
max
The maximum score to remove from the set.
callback
The callback function, the Int will contain the number of elements removed from the sorted set. NSError will be non-nil if an error occurred.
-
Return a range of members in a sorted set, by index, with scores ordered from high to low
Parameter
Parameter key: The key.Parameter
Parameter start: The starting index to return from the set.Parameter
Parameter stop: The stoping index to return from the set.Parameter
Parameter withscores: Whether or not to return scores as well.Parameter
Parameter callback: The callback function, the Array will conatian the list of elements in the specified range (optionally with their scores). NSError will be non-nil if an error occurred.Declaration
Swift
public func zrevrange(_ key: String, start: Int, stop: Int, withscores: Bool = false, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
start
The starting index to return from the set.
stop
The stoping index to return from the set.
withscores
Whether or not to return scores as well.
callback
The callback function, the Array will conatian the list of elements in the specified range (optionally with their scores). NSError will be non-nil if an error occurred.
-
Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.
Parameter
Parameter key: The key.Parameter
Parameter min: The minimum score to return from the set.Parameter
Parameter max: The maximum score to return from the set.Parameter
Parameter callback: The callback function, the Array will conatian the list of elements in the specified lexicographical range. NSError will be non-nil if an error occurred.Declaration
Swift
public func zrevrangebylex(_ key: String, min: String, max: String, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
min
The minimum score to return from the set.
max
The maximum score to return from the set.
callback
The callback function, the Array will conatian the list of elements in the specified lexicographical range. NSError will be non-nil if an error occurred.
-
Return a range of members in a sorted set, by score, with scores ordered from high to low.
Parameter
Parameter key: The key.Parameter
Parameter max: The minimum score to return from the set.Parameter
Parameter min: The maximum score to return from the set.Parameter
Parameter withscores: The bool whether to return the scores as wellParameter
Parameter callback: The callback function, the Array will conatian the list of elements in the specified score range (optionally with their scores) NSError will be non-nil if an error occurred.Declaration
Swift
public func zrevrangebyscore(_ key: String, min: String, max: String, withscores: Bool = false, callback: ([RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
max
The minimum score to return from the set.
min
The maximum score to return from the set.
withscores
The bool whether to return the scores as well
callback
The callback function, the Array will conatian the list of elements in the specified score range (optionally with their scores) NSError will be non-nil if an error occurred.
-
Determine the index of a member in a sorted set, with scores ordered from high to low.
Parameter
Parameter key: The key.Parameter
Parameter member: The member to get the rank of.Parameter
Parameter callback: The callback function, the Int will contain the rank of the member when the set is in reverse order. If member does not exist in the sorted set or key does not exist returns nil. NSError will be non-nil if an error occurred.Declaration
Swift
public func zrevrank(_ key: String, member: String, callback: (Int?, NSError?) -> Void)
Parameters
key
The key.
member
The member to get the rank of.
callback
The callback function, the Int will contain the rank of the member when the set is in reverse order. If member does not exist in the sorted set or key does not exist returns nil. NSError will be non-nil if an error occurred.
-
Incrementally iterate sorted sets elements and associated scores.
Parameter
Parameter key: The key.Parameter
Parameter cursor: iteratorParameter
Parameter match: glob-style patternParameter
Parameter callback: The callback function, theRedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred. Declaration
Swift
public func zscan(_ key: String, cursor: Int, match: String? = nil, count: Int? = nil, callback: (RedisString?, [RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
cursor
iterator
match
glob-style pattern
count
The amount of work that should be done at every call in order to retrieve elements from the collection.
callback
The callback function, the
RedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred. -
Incrementally iterate sorted sets elements and associated scores.
Parameter
Parameter key: The key.Parameter
Parameter cursor: iteratorParameter
Parameter match: glob-style patternParameter
Parameter callback: The callback function, theRedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred. Declaration
Swift
public func zscan(_ key: RedisString, cursor: Int, match: RedisString? = nil, count: Int? = nil, callback: (RedisString?, [RedisString?]?, NSError?) -> Void)
Parameters
key
The key.
cursor
iterator
match
glob-style pattern
count
The amount of work that should be done at every call in order to retrieve elements from the collection.
callback
The callback function, the
RedisString
will contain the cursor to use to continue the scan, the Arraywill contain the found elements. NSError will be non-nil if an error occurred. -
Get the score associated with the given member in a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter member: The member to get the score from.Parameter
Parameter callback: The callback function, the RedisString will contain the score of member. NSError will be non-nil if an error occurred.Declaration
Swift
public func zscore(_ key: String, member: String, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
member
The member to get the score from.
callback
The callback function, the RedisString will contain the score of member. NSError will be non-nil if an error occurred.
-
Get the score associated with the given member in a sorted set.
Parameter
Parameter key: The key.Parameter
Parameter member: The member to get the score from.Parameter
Parameter callback: The callback function, the RedisString will contain the score of member. NSError will be non-nil if an error occurred.Declaration
Swift
public func zscore(_ key: String, member: RedisString, callback: (RedisString?, NSError?) -> Void)
Parameters
key
The key.
member
The member to get the score from.
callback
The callback function, the RedisString will contain the score of member. NSError will be non-nil if an error occurred.
-
Add multiple sorted sets and store the resulting sorted set in a new key
Parameter
Parameter destination: The destination where the result will be stored.Parameter
Parameter numkeys: The number of keys to union.Parameter
Parameter keys: The keys.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.Declaration
Swift
public func zunionstore(_ destination: String, numkeys: Int, keys: String..., weights: [Int] = [], aggregate: String = "", callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination where the result will be stored.
numkeys
The number of keys to union.
keys
The keys.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.
-
Add multiple sorted sets and store the resulting sorted set in a new key
Parameter
Parameter destination: The destination where the result will be stored.Parameter
Parameter numkeys: The number of keys to union.Parameter
Parameter keys: The keys.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.Declaration
Swift
public func zunionstoreWithArray(_ destination: String, numkeys: Int, keys: [String], weights: [Int], aggregate: String, callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination where the result will be stored.
numkeys
The number of keys to union.
keys
The keys.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.
-
Add multiple sorted sets and store the resulting sorted set in a new key
Parameter
Parameter destination: The destination where the result will be stored.Parameter
Parameter numkeys: The number of keys to union.Parameter
Parameter keys: The keys.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.Declaration
Swift
public func zunionstore(_ destination: String, numkeys: Int, keys: RedisString..., weights: [Int] = [], aggregate: RedisString = RedisString(""), callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination where the result will be stored.
numkeys
The number of keys to union.
keys
The keys.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.
-
Add multiple sorted sets and store the resulting sorted set in a new key
Parameter
Parameter destination: The destination where the result will be stored.Parameter
Parameter numkeys: The number of keys to union.Parameter
Parameter keys: The keys.Parameter
Parameter weights: A multiplication factor for each input sorted set.Parameter
Parameter aggregate: Specify how the results of the union are aggregated.Parameter
Parameter callback: The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.Declaration
Swift
public func zunionstoreWithArray(_ destination: String, numkeys: Int, keys: [RedisString], weights: [Int], aggregate: RedisString, callback: (Int?, NSError?) -> Void)
Parameters
destination
The destination where the result will be stored.
numkeys
The number of keys to union.
keys
The keys.
weights
A multiplication factor for each input sorted set.
aggregate
Specify how the results of the union are aggregated.
callback
The callback function, the Int will contain the number of elements in the resulting sorted set at destination. NSError will be non-nil if an error occured.