class RedisCluster extends ClusterConnection with Connection with ClusterCommands with HashCommands with HyperLogLogCommands with KeyCommands with ListCommands with PubSubCommands with ScriptingCommands with SetCommands with SortedSetCommands with StringCommands
Defines a RedisCluster
scredis.Client supporting all non-blocking commands that can be addressed to either
any cluster node or be automatically routed to the correct node.
- Alphabetic
- By Inheritance
- RedisCluster
- StringCommands
- SortedSetCommands
- SetCommands
- ScriptingCommands
- PubSubCommands
- ListCommands
- KeyCommands
- HyperLogLogCommands
- HashCommands
- ClusterCommands
- Connection
- ClusterConnection
- LazyLogging
- NonBlockingConnection
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new RedisCluster(system: ActorSystem)
Constructs a scredis.RedisCluster instance using the default config.
Constructs a scredis.RedisCluster instance using the default config.
- system
Actor system
- returns
the constructed scredis.RedisCluster
- new RedisCluster()
Constructs a scredis.RedisCluster instance using the default config.
Constructs a scredis.RedisCluster instance using the default config.
- returns
the constructed scredis.RedisCluster
- new RedisCluster(config: RedisConfig, systemOpt: Option[ActorSystem])
Constructs a scredis.RedisCluster instance from a scredis.RedisConfig.
Constructs a scredis.RedisCluster instance from a scredis.RedisConfig.
- returns
the constructed scredis.RedisCluster
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def append[W](key: String, value: W)(implicit arg0: Writer[W]): Future[Long]
Appends a value to a key.
Appends a value to a key.
- key
the key to be appended
- value
the value to append
- returns
the length of the string after the append operation
- Definition Classes
- StringCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bitCount(key: String, start: Long = 0, stop: Long = -1): Future[Long]
Counts the number of bits set to 1 in a string from start offset to stop offset.
Counts the number of bits set to 1 in a string from start offset to stop offset.
- key
the key for which the bitcount should be returned
- start
start offset (defaults to 0)
- stop
stop offset (defaults to -1)
- returns
the number of bits set to 1 in the specified interval
- Definition Classes
- StringCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string- Note
Non-existent keys are treated as empty strings, so the command will return zero.
- def bitOp(operation: BitOp, destKey: String, keys: String*): Future[Long]
Performs a bitwise operation between multiple strings.
Performs a bitwise operation between multiple strings.
- operation
scredis.BitOp to perform
- destKey
destination key where the result of the operation will be stored
- keys
keys to perform the operation upon
- returns
the size of the string stored in the destination key, that is equal to the size of the longest input string
- Definition Classes
- StringCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if at least one of the values stored at keys is not of type string- Note
When an operation is performed between strings having different lengths, all the strings shorter than the longest string in the set are treated as if they were zero-padded up to the length of the longest string. The same holds true for non-existent keys, that are considered as a stream of zero bytes up to the length of the longest string.
- def bitPos(key: String, bit: Boolean, start: Long = 0, stop: Long = -1): Future[Long]
Return the position of the first bit set to 1 or 0 in a string.
Return the position of the first bit set to 1 or 0 in a string.
- key
string key
- bit
provide true to look for 1s and false to look for 0s
- start
start offset, in bytes
- stop
stop offset, in bytes
- returns
the position of the first bit set to 1 or 0, according to the request
- Definition Classes
- StringCommands
- Since
2.8.7
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key is not of type string- Note
The position is returned thinking at the string as an array of bits from left to right where the first byte most significant bit is at position 0, the second byte most significant big is at position 8 and so forth. The range is interpreted as a range of bytes and not a range of bits, so start=0 and end=2 means to look at the first three bytes. If we look for set bits (the bit argument is 1) and the string is empty or composed of just zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string only contains bit set to 1, the function returns the first bit not part of the string on the right. So if the string is tree bytes set to the value 0xff the command BITPOS key 0 will return 24, since up to bit 23 all the bits are 1. Basically the function consider the right of the string as padded with zeros if you look for clear bits and specify no range or the start argument only. However this behavior changes if you are looking for clear bits and specify a range with both start and stop. If no clear bit is found in the specified range, the function returns -1 as the user specified a clear range and there are no 0 bits in that range.
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def clusterAddSlots(slot: Long, slots: Long*): Future[Unit]
Assign new hash slots to receiving node
Assign new hash slots to receiving node
- slot
a slot
- slots
more slots
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterCountFailureReports(nodeId: String): Future[Long]
Return the number of failure reports active for a given node.
Return the number of failure reports active for a given node.
- nodeId
node to get failures for
- returns
the number of active failure reports for the node
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterCountKeysInSlot(slot: Long): Future[Long]
Return the number of local keys in the specified hash slot.
Return the number of local keys in the specified hash slot.
- slot
slot to count keys in
- returns
the number of local keys in the specified hash slot
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterDelSlots(slot: Long, slots: Long*): Future[Unit]
Set hash slots as unbound in receiving node.
Set hash slots as unbound in receiving node.
- slot
a slot
- slots
more slots
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterFailover(): Future[Unit]
Forces a slave to perform a manual failover of its master.
Forces a slave to perform a manual failover of its master.
- Definition Classes
- ClusterCommands
- def clusterFailoverForce(): Future[Unit]
Forces a slave to perform a manual failover of its master.
Forces a slave to perform a manual failover of its master.
FORCE option: manual failover when the master is down.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterFailoverTakeover(): Future[Unit]
Forces a slave to perform a manual failover of its master.
Forces a slave to perform a manual failover of its master.
TAKEOVER option: manual failover without cluster consensus. TAKEOVER option implies everything FORCE implies, but also does not uses any cluster authorization in order to failover.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterForget(nodeId: String): Future[Unit]
Remove a node from the nodes table.
- def clusterGetKeysInSlot(slot: Long, count: Long): Future[Set[String]]
Return local key names in the specified hash slot.
Return local key names in the specified hash slot.
- slot
slot to get key names from
- count
number of keys to return
- returns
local key names in the specified hash slot
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterInfo(): Future[Map[String, String]]
Provides info about Redis Cluster node state.
Provides info about Redis Cluster node state.
- returns
Key-value mapping of Redis Cluster vital parameters.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterKeyslot(key: String): Future[Long]
Returns the hash slot of the specified key.
Returns the hash slot of the specified key.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterMeet(ip: String, port: Long): Future[Unit]
Force a node cluster to handshake with another node.
Force a node cluster to handshake with another node.
- ip
ip address of
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterNodes(): Future[Seq[ClusterNode]]
Get Cluster config for the node.
Get Cluster config for the node.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterReplicate(nodeId: String): Future[Unit]
Reconfigure a node as a slave of the specified master node.
Reconfigure a node as a slave of the specified master node.
- nodeId
master node to replicate
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterReset(): Future[Unit]
Reset a Redis Cluster node.
Reset a Redis Cluster node.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterResetHard(): Future[Unit]
Reset a Redis Cluster node with HARD option.
Reset a Redis Cluster node with HARD option.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSaveConfig(): Future[Unit]
Forces the node to save cluster state on disk.
Forces the node to save cluster state on disk.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSetConfigEpoch(configEpoch: Long): Future[Unit]
Set the configuration epoch in a new node.
Set the configuration epoch in a new node.
- configEpoch
the config epoch to set
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSetSlotImporting(slot: Long, sourceNode: String): Future[Unit]
Set a hash slot in importing state.
Set a hash slot in importing state.
- slot
slot to import
- sourceNode
node to import from
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSetSlotMigrating(slot: Long, destinationNode: String): Future[Unit]
Set a hash slot in migrating state.
Set a hash slot in migrating state.
- slot
slot to migrate
- destinationNode
node to migrate to
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSetSlotNode(slot: Long, nodeId: String): Future[Unit]
Bind the hash slot to a different node.
Bind the hash slot to a different node.
- slot
slot to associate with node
- nodeId
node to be associated with slot
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSetSlotStable(slot: Long): Future[Unit]
Clear any importing / migrating state from hash slot.
Clear any importing / migrating state from hash slot.
- slot
slot to clear of migrating/importing state
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSlaves(nodeId: String): Future[Seq[ClusterNode]]
List slave nodes of the specified master node.
List slave nodes of the specified master node.
- nodeId
node to list slave nodes of
- returns
slave nodes of the given master
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def clusterSlots(): Future[List[ClusterSlotRange]]
Get array of Cluster slot to node mappings.
Get array of Cluster slot to node mappings.
- returns
List of cluster slot ranges, with respective master and slave nodes.
- Definition Classes
- ClusterCommands
- Since
3.0.0
- def decr(key: String): Future[Long]
Decrements the integer value of a key by one.
Decrements the integer value of a key by one.
- key
the key to decrement
- returns
the value of key after the decrement
- Definition Classes
- StringCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains a string that cannot be represented as integer- Note
If the key does not exist, it is set to 0 before performing the operation.
- def decrBy(key: String, decrement: Long): Future[Long]
Decrements the integer value of a key by the given amount.
Decrements the integer value of a key by the given amount.
- key
the key to decrement
- decrement
the decrement
- returns
the value of key after the decrement
- Definition Classes
- StringCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains a string that cannot be represented as integer- Note
If the key does not exist, it is set to 0 before performing the operation.
- def del(keys: String*): Future[Long]
Deletes one or multiple keys.
Deletes one or multiple keys.
- keys
key(s) to delete
- returns
the number of keys that were deleted
- Definition Classes
- KeyCommands
- Since
1.0.0
- Note
a key is ignored if it does not exist
- implicit val dispatcher: ExecutionContext
- Definition Classes
- RedisCluster → Connection
- def dump(key: String): Future[Option[Array[Byte]]]
Returns a serialized version of the value stored at the specified key.
Returns a serialized version of the value stored at the specified key.
- key
key to dump
- returns
the serialized value or
None
if the key does not exist
- Definition Classes
- KeyCommands
- Since
2.6.0
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def eval[R, W1, W2](script: String, keys: Seq[W1] = Nil, args: Seq[W2] = Nil)(implicit arg0: Decoder[R], arg1: Writer[W1], arg2: Writer[W2]): Future[R]
Executes a Lua script that does not require any keys or arguments.
Executes a Lua script that does not require any keys or arguments.
- script
the LUA script
- keys
keys to be used in the script
- args
arguments to be used in the script
- Definition Classes
- ScriptingCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if an error occurs while running the script[[scredis.exceptions.RedisProtocolException]]
if the result could not be decoded by providedDecoder
- def evalSHA[R, W1, W2](sha1: String, keys: Seq[W1] = Nil, args: Seq[W2] = Nil)(implicit arg0: Decoder[R], arg1: Writer[W1], arg2: Writer[W2]): Future[R]
Executes a cached Lua script that does not require any keys or arguments by its SHA1 digest.
Executes a cached Lua script that does not require any keys or arguments by its SHA1 digest.
- sha1
the SHA1 digest
- keys
keys to be used in the script
- args
arguments to be used in the script
- Definition Classes
- ScriptingCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if there is no script corresponding to the provided SHA1 digest or if an error occurs while running the script[[scredis.exceptions.RedisProtocolException]]
if the result could not be decoded by providedDecoder
- def exists(key: String): Future[Boolean]
Determines if a key exists.
Determines if a key exists.
- key
key to check for existence
- returns
true if the key exists, false otherwise
- Definition Classes
- KeyCommands
- Since
1.0.0
- def expire(key: String, ttlSeconds: Int): Future[Boolean]
Sets a key's time to live in seconds.
Sets a key's time to live in seconds.
- key
key to expire
- ttlSeconds
time-to-live in seconds
- returns
true if the ttl was set, false if key does not exist or the timeout could not be set
- Definition Classes
- KeyCommands
- Since
1.0.0
- def expireAt(key: String, timestamp: Long): Future[Boolean]
Sets the expiration for a key as a UNIX timestamp.
Sets the expiration for a key as a UNIX timestamp.
- key
key to expire
- timestamp
UNIX timestamp at which the key should expire
- returns
true if the ttl was set, false if key does not exist or the timeout could not be set
- Definition Classes
- KeyCommands
- Since
1.2.0
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def get[R](key: String)(implicit arg0: Reader[R]): Future[Option[R]]
Returns the value stored at key.
Returns the value stored at key.
- key
the target key
- returns
value stored at key, or
None
if the key does not exist
- Definition Classes
- StringCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
- def getBit(key: String, offset: Long): Future[Boolean]
Returns the bit value at offset in the string value stored at key.
Returns the bit value at offset in the string value stored at key.
- key
the target key
- offset
the position in the string
- returns
true if the bit is set to 1, false otherwise
- Definition Classes
- StringCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getRange[R](key: String, start: Long, stop: Long)(implicit arg0: Reader[R]): Future[R]
Returns a substring of the string stored at a key.
Returns a substring of the string stored at a key.
- key
the target key
- start
the start offset (inclusive)
- stop
the stop offset (inclusive)
- returns
the substring determined by the specified offsets, or the empty string if the key does not exist
- Definition Classes
- StringCommands
- Since
2.4.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string- Note
Both offsets are inclusive, i.e. [start, stop]. The function handles out of range requests by limiting the resulting range to the actual length of the string.
- def getSet[R, W](key: String, value: W)(implicit arg0: Reader[R], arg1: Writer[W]): Future[Option[R]]
Sets the string value of a key and return its old value.
Sets the string value of a key and return its old value.
- key
the target key
- value
the value to set key to
- returns
the old value, or
None
if the latter did not exist
- Definition Classes
- StringCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type string
- def hDel(key: String, fields: String*): Future[Long]
Deletes one or more hash fields.
Deletes one or more hash fields.
- key
key of the hash
- fields
field(s) to be deleted from hash
- returns
the number of fields that were removed from the hash, not including specified but non existing fields
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash- Note
Specified fields that do not exist within this hash are ignored. If key does not exist, it is treated as an empty hash and this command returns 0. Redis versions older than 2.4 can only remove a field per call.
- def hExists(key: String, field: String): Future[Boolean]
Determines if a hash field exists.
Determines if a hash field exists.
- key
hash key
- field
name of the field
- returns
true if the hash contains field, false if the hash does not contain it or the key does not exists
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
- def hGet[R](key: String, field: String)(implicit arg0: Reader[R]): Future[Option[R]]
Returns the value of a hash field.
Returns the value of a hash field.
- key
hash key
- field
field name to retrieve
- returns
the value associated with field name, or
None
when field is not present in the hash or key does not exist
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
- def hGetAll[R](key: String)(implicit arg0: Reader[R]): Future[Option[Map[String, R]]]
Returns all the fields and values in a hash.
Returns all the fields and values in a hash.
- key
hash key
- returns
key-value pairs stored in hash with key, or
None
when hash is empty or key does not exist
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
- def hIncrBy(key: String, field: String, count: Long): Future[Long]
Increments the integer value of a hash field by the given number.
Increments the integer value of a hash field by the given number.
- key
hash key
- field
field name to increment
- count
increment
- returns
the value at field after the increment operation
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the field does not hold an integer value or if the value stored at key is not of type hash- Note
If key does not exist, a new key holding a hash is created. If field does not exist the value is set to 0 before the operation is performed.
- def hIncrByFloat(key: String, field: String, count: Double): Future[Double]
Increments the float value of a hash field by the given amount.
Increments the float value of a hash field by the given amount.
- key
hash key
- field
field name to increment
- count
increment
- returns
the value at field after the increment operation
- Definition Classes
- HashCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the field does not hold a floating point value or if the value stored at key is not of type hash- Note
If key does not exist, a new key holding a hash is created. If field does not exist the value is set to 0 before the operation is performed.
- def hKeys(key: String): Future[Set[String]]
Returns all the fields in a hash.
Returns all the fields in a hash.
- key
hash key
- returns
set of field names or the empty set if the hash is empty or the key does not exist
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
- def hLen(key: String): Future[Long]
Returns the number of fields contained in the hash stored at key.
Returns the number of fields contained in the hash stored at key.
- key
hash key
- returns
number of fields in the hash, or 0 if the key does not exist
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
- def hScan[R](key: String, cursor: Long, matchOpt: Option[String] = None, countOpt: Option[Int] = None)(implicit arg0: Reader[R]): Future[(Long, List[(String, R)])]
Incrementally iterates through the fields of a hash.
Incrementally iterates through the fields of a hash.
- cursor
the offset
- matchOpt
when defined, the command only returns elements matching the pattern
- countOpt
when defined, provides a hint of how many elements should be returned
- returns
a pair containing the next cursor as its first element and the list of fields (key-value pairs) as its second element
- Definition Classes
- HashCommands
- Since
2.8.0
- def hSet[W](key: String, field: String, value: W)(implicit arg0: Writer[W]): Future[Boolean]
Sets the string value of a hash field.
Sets the string value of a hash field.
- key
hash key
- field
field name to set
- value
value to set
- returns
true if field is a new field in the hash and value was set, false if field already exists and the value was updated
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash- Note
If the field already exists in the hash, it is overwritten.
- def hSetNX[W](key: String, field: String, value: W)(implicit arg0: Writer[W]): Future[Boolean]
Sets the value of a hash field, only if the field does not exist.
Sets the value of a hash field, only if the field does not exist.
- key
hash key
- field
field name to set
- value
value to set
- returns
true if field is a new field in the hash and value was set, false if field already exists and no operation was performed
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
- def hStrlen(key: String, field: String): Future[Long]
Returns the length of the value associated with field in the hash stored at key.
Returns the length of the value associated with field in the hash stored at key. For numbers it is a count of their digits (+1 if number is negative) For booleans it is true=4 and false=5 For strings it is number of bytes they occupy. ONLY if you don't use utf characters it will be their length. If the key or the field do not exist, 0 is returned.
- key
hash key
- field
field name to set
- returns
the string length of the value associated with field, or zero when field is not present in the hash or key does not exist at all.
- Definition Classes
- HashCommands
- def hVals[R](key: String)(implicit arg0: Reader[R]): Future[List[R]]
Returns all the values in a hash.
Returns all the values in a hash.
- key
hash key
- returns
list of values, or the empty list if hash is empty or key does not exist
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hmGet[R](key: String, fields: String*)(implicit arg0: Reader[R]): Future[List[Option[R]]]
Returns the values associated to the specified hash fields.
Returns the values associated to the specified hash fields.
- key
hash key
- fields
field(s) to retrieve
- returns
list of value(s) associated to the specified field name(s)
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash- Note
For every field that does not exist,
None
is returned.
- def hmGetAsMap[R](key: String, fields: String*)(implicit arg0: Reader[R]): Future[Map[String, R]]
Returns a
Map
containing field-value pairs associated to the specified hash fields.Returns a
Map
containing field-value pairs associated to the specified hash fields.- key
hash key
- fields
field(s) to retrieve
- returns
field-value pairs associated to the specified field name(s)
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash- Note
Every non-existent field gets removed from the resulting
Map
.
- def hmSet[W](key: String, fieldValuePairs: Map[String, W])(implicit arg0: Writer[W]): Future[Unit]
Sets multiple hash fields to multiple values.
Sets multiple hash fields to multiple values.
- key
hash key
- fieldValuePairs
field-value pair(s) to be set
- Definition Classes
- HashCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value stored at key is not of type hash- Note
This command overwrites any existing fields in the hash. If key does not exist, a new key holding a hash is created
- def incr(key: String): Future[Long]
Increments the integer value of a key by one.
Increments the integer value of a key by one.
- key
the key to increment
- returns
the value of key after the increment
- Definition Classes
- StringCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains a string that cannot be represented as integer- Note
If the key does not exist, it is set to 0 before performing the operation.
- def incrBy(key: String, increment: Long): Future[Long]
Increments the integer value of a key by the given amount.
Increments the integer value of a key by the given amount.
- key
the key to increment
- increment
the increment
- returns
the value of key after the decrement
- Definition Classes
- StringCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type or contains a string that cannot be represented as integer- Note
If the key does not exist, it is set to 0 before performing the operation.
- def incrByFloat(key: String, increment: Double): Future[Double]
Increment the float value of a key by the given amount.
Increment the float value of a key by the given amount.
- key
the key to increment
- increment
the increment
- returns
the value of key after the decrement
- Definition Classes
- StringCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type, the current key content or the specified increment are not parseable as a double precision floating point number- Note
If the key does not exist, it is set to 0 before performing the operation.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def keys(pattern: String): Future[Set[String]]
Finds all keys matching the given pattern.
Finds all keys matching the given pattern.
- pattern
pattern to search for
- returns
the matched keys, or the empty set if no keys match the given pattern
- Definition Classes
- KeyCommands
- Since
1.0.0
- def lIndex[R](key: String, index: Long)(implicit arg0: Reader[R]): Future[Option[R]]
Returns an element from a list by its index.
Returns an element from a list by its index.
- key
list key
- index
zero-based position in the list
- returns
the requested element, or
None
when index is out of range
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value- Note
The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth.
- def lInsert[W1, W2](key: String, position: Position, pivot: W1, value: W2)(implicit arg0: Writer[W1], arg1: Writer[W2]): Future[Option[Long]]
Inserts an element before or after another element in a list.
Inserts an element before or after another element in a list.
- key
list key
- position
tell if a new value should be placed after of before pivot
- pivot
value after/before which the element should be inserted
- value
element to be inserted
- returns
the length of the list after the insert operation, or None if the index is out of range
- Definition Classes
- ListCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
- def lLen(key: String): Future[Long]
Returns the length of a list.
Returns the length of a list.
- key
list key
- returns
the length of the list at key, or 0 if the key does not exist
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
- def lPop[R](key: String)(implicit arg0: Reader[R]): Future[Option[R]]
Removes and returns the first element of a list.
Removes and returns the first element of a list.
- key
list key
- returns
the popped element, or
None
if the key does not exist
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
- def lPush[W](key: String, values: W*)(implicit arg0: Writer[W]): Future[Long]
Prepends one or multiple values to a list.
Prepends one or multiple values to a list.
- key
list key
- values
value(s) to prepend
- returns
the length of the list after the push operations
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value- Note
If key does not exist, it is created as empty list before performing the push operation. Redis versions older than 2.4 can only push one value per call.
- def lPushX[W](key: String, value: W)(implicit arg0: Writer[W]): Future[Long]
Prepends a value to a list, only if the list exists.
Prepends a value to a list, only if the list exists.
- key
list key
- value
value to prepend
- returns
the length of the list after the push operation
- Definition Classes
- ListCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
- def lRange[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[List[R]]
Returns a range of elements from a list.
Returns a range of elements from a list.
- key
list key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- returns
list of elements in the specified range, or the empty list if there are no such elements or the key does not exist
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value- Note
The offsets start and end are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list. For example, -1 is the last element of the list, -2 the penultimate, and so on. Both offsets are inclusive, i.e. LRANGE key 0 10 will return 11 elements (if they exist).
- def lRem[W](key: String, value: W, count: Int = 0)(implicit arg0: Writer[W]): Future[Long]
Removes the first count occurrences of elements equal to value from the list stored at key.
Removes the first count occurrences of elements equal to value from the list stored at key.
- key
list key
- value
value to be removed from the list
- count
indicates the number of found values that should be removed, see above note
- returns
the number of removed elements
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value- Note
The count argument influences the operation in the following ways:
count > 0: Remove elements equal to value moving from head to tail. count < 0: Remove elements equal to value moving from tail to head. count = 0: Remove all elements equal to value.
- def lSet[W](key: String, index: Long, value: W)(implicit arg0: Writer[W]): Future[Unit]
Sets the value of an element in a list by its index.
Sets the value of an element in a list by its index.
- key
list key
- index
position of the element to set
- value
value to be set at index
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if index is out of range or if key contains a non-list value
- def lTrim(key: String, start: Long, stop: Long): Future[Unit]
Trims a list to the specified range.
Trims a list to the specified range.
- key
list key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value- Note
Out of range indexes will not produce an error: if start is larger than the end of the list, or start > end, the result will be an empty list (which causes key to be removed). If end is larger than the end of the list, Redis will treat it like the last element of the list.
- lazy val logger: Logger
- Attributes
- protected
- Definition Classes
- LazyLogging
- Annotations
- @transient()
- def mGet[R](keys: String*)(implicit arg0: Reader[R]): Future[List[Option[R]]]
Returns the values of all specified keys.
Returns the values of all specified keys.
- keys
the keys to fetch
- returns
list of value(s) stored at the specified key(s)
- Definition Classes
- StringCommands
- Since
1.0.0
- Note
For every key that does not hold a string value or does not exist,
None
is returned. Because of this, the operation never fails.
- def mGetAsMap[R](keys: String*)(implicit arg0: Reader[R]): Future[Map[String, R]]
Returns a
Map
containing the specified key(s) paired to their respective value(s).Returns a
Map
containing the specified key(s) paired to their respective value(s).- keys
the keys to fetch
- returns
map of key-value pairs
- Definition Classes
- StringCommands
- Since
1.0.0
- Note
Every key that does not hold a string value or does not exist will be removed from the resulting
Map
.
- def mSet[W](keyValuePairs: Map[String, W])(implicit arg0: Writer[W]): Future[Unit]
Atomically sets multiple keys to multiple values.
Atomically sets multiple keys to multiple values.
- keyValuePairs
map of key-value pairs to set
- Definition Classes
- StringCommands
- Since
1.0.1
- Note
MSET replaces existing values with new values, just as regular SET.
- def mSetNX[W](keyValuePairs: Map[String, W])(implicit arg0: Writer[W]): Future[Boolean]
Atomically sets multiple keys to multiple values, only if none of the keys exist.
Atomically sets multiple keys to multiple values, only if none of the keys exist.
- keyValuePairs
map of key-value pairs to set
- returns
true if all the keys were set, false if at least one key already existed and thus no operation was performed.
- Definition Classes
- StringCommands
- Since
1.0.1
- Note
MSETNX will not perform any operation at all even if just a single key already exists.
- def migrate(key: String, host: String, port: Int = 6379, database: Int = 0, timeout: FiniteDuration = 2 seconds, copy: Boolean = false, replace: Boolean = false): Future[Unit]
Atomically transfers a key from a Redis instance to another one.
Atomically transfers a key from a Redis instance to another one.
- key
key to transfer
- host
destination host
- port
destination port
- database
destination database
- timeout
timeout duration, up to milliseconds precision
- copy
if true, do not remove the key from the local instance
- replace
if true, replace existing key on the remote instance
- Definition Classes
- KeyCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if an error occurs
- def move(key: String, database: Int): Future[Boolean]
Moves a key to another database.
Moves a key to another database.
- key
key to move
- database
destination database
- returns
true if key was moved, false otherwise
- Definition Classes
- KeyCommands
- Since
1.0.0
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def objectEncoding(key: String): Future[Option[String]]
Returns the kind of internal representation used in order to store the value associated with a key.
Returns the kind of internal representation used in order to store the value associated with a key.
- key
the key
- returns
the object encoding or
None
if the key does not exist
- Definition Classes
- KeyCommands
- Since
2.2.3
- Note
Objects can be encoded in different ways: Strings can be encoded as
raw
orint
Lists can be encoded asziplist
orlinkedlist
Sets can be encoded asintset
orhashtable
Hashes can be encoded aszipmap
orhashtable
SortedSets can be encoded asziplist
orskiplist
- def objectIdleTime(key: String): Future[Option[Long]]
Returns the number of seconds since the object stored at the specified key is idle (not requested by read or write operations).
Returns the number of seconds since the object stored at the specified key is idle (not requested by read or write operations).
- key
the key
- returns
the number of seconds since the object is idle or
None
if the key does not exist
- Definition Classes
- KeyCommands
- Since
2.2.3
- Note
While the value is returned in seconds the actual resolution of this timer is 10 seconds, but may vary in future implementations.
- def objectRefCount(key: String): Future[Option[Long]]
Returns the number of references of the value associated with the specified key.
Returns the number of references of the value associated with the specified key.
- key
the key
- returns
the number of references or
None
if the key does not exist
- Definition Classes
- KeyCommands
- Since
2.2.3
- def pExpire(key: String, ttlMillis: Long): Future[Boolean]
Sets a key's time to live in milliseconds.
Sets a key's time to live in milliseconds.
- key
key to expire
- ttlMillis
time-to-live in milliseconds
- returns
true if the ttl was set, false if key does not exist or the timeout could not be set
- Definition Classes
- KeyCommands
- Since
2.6.0
- def pExpireAt(key: String, timestampMillis: Long): Future[Boolean]
Sets the expiration for a key as a UNIX timestamp specified in milliseconds.
Sets the expiration for a key as a UNIX timestamp specified in milliseconds.
- key
key to expire
- timestampMillis
UNIX milliseconds-timestamp at which the key should expire
- returns
true if the ttl was set, false if key does not exist or the timeout could not be set
- Definition Classes
- KeyCommands
- Since
2.6.0
- def pSetEX[W](key: String, value: W, ttlMillis: Long)(implicit arg0: Writer[W]): Future[Unit]
Sets the value and expiration in milliseconds of a key.
Sets the value and expiration in milliseconds of a key.
- key
target key to set
- value
value to be stored at key
- ttlMillis
time-to-live in milliseconds
- Definition Classes
- StringCommands
- Since
2.6.0
- Note
If key already holds a value, it is overwritten, regardless of its type.
- def pTtl(key: String): Future[Either[Boolean, Long]]
Gets the time to live for a key in milliseconds.
Gets the time to live for a key in milliseconds.
result match { case Left(false) => // key does not exist case Left(true) => // key exists but has no associated expire case Right(ttl) => }
- key
the target key
- returns
Right(ttl)
where ttl is the time-to-live in milliseconds for specified key,Left(false)
if key does not exist orLeft(true)
if key exists but has no associated expire
- Definition Classes
- KeyCommands
- Since
2.6.0
- Note
For
Redis
version <= 2.8.x,Left(false)
will be returned when the key does not exists and when it exists but has no associated expire (Redis
returns the same error code for both cases). In other words, you can simply check the followingresult match { case Left(_) => case Right(ttl) => }
- def persist(key: String): Future[Boolean]
Removes the expiration from a key.
Removes the expiration from a key.
- key
key to persist
- returns
true if key was persisted, false if key does not exist or does not have an associated timeout
- Definition Classes
- KeyCommands
- Since
2.2.0
- def pfAdd[W](key: String, elements: W*)(implicit arg0: Writer[W]): Future[Boolean]
Adds all the element arguments to the HyperLogLog data structure stored at specified key.
Adds all the element arguments to the HyperLogLog data structure stored at specified key.
- key
the key of the HyperLogLog data structure
- elements
element(s) to add to the HyperLogLog data structure
- returns
true if at least one HyperLogLog internal register was altered, false otherwise
- Definition Classes
- HyperLogLogCommands
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key is not of HyperLogLog type- Note
The HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself). The returned cardinality of the observed set is not exact, but approximated with a standard error of 0.81%.
- def pfCount(keys: String*): Future[Long]
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
When called with multiple keys, returns the approximated cardinality of the union of the HyperLogLogs passed, by internally merging the HyperLogLogs stored at the provided keys into a temporary HyperLogLog.
- keys
key(s) of the HyperLogLog data structure to count
- returns
the approximate number of unique elements observed via PFADD
- Definition Classes
- HyperLogLogCommands
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if at least one key is not of HyperLogLog type- Note
The HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself). The returned cardinality of the observed set is not exact, but approximated with a standard error of 0.81%.
- def pfMerge(destKey: String, keys: String*): Future[Unit]
Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
The computed merged HyperLogLog is set to the destination variable, which is created if does not exist (defauling to an empty HyperLogLog).
- destKey
the destination key where the result should be stored
- keys
keys of the HyperLogLog data structure to merge
- Definition Classes
- HyperLogLogCommands
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if at least one key is not of HyperLogLog type- Note
The HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself). The returned cardinality of the observed set is not exact, but approximated with a standard error of 0.81%.
- def pubSubChannels(patternOpt: Option[String] = None): Future[List[String]]
Lists the currently active channels.
Lists the currently active channels. An active channel is a Pub/Sub channel with one or more subscribers (not including clients subscribed to patterns).
- patternOpt
optional pattern to filter returned channels
- returns
the currently active channels, optionally matching the specified pattern
- Definition Classes
- PubSubCommands
- Since
2.8.0
- Note
If no pattern is specified, all the channels are listed, otherwise if pattern is specified only channels matching the specified glob-style pattern are listed.
- def pubSubNumPat(): Future[Long]
Returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command).
Returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command).
- returns
the number of subscriptions to patterns
- Definition Classes
- PubSubCommands
- Since
2.8.0
- Note
Note that this is not just the count of clients subscribed to patterns but the total number of patterns all the clients are subscribed to.
- def pubSubNumSub(channels: String*): Future[Map[String, Int]]
Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels.
Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels.
- channels
channel name(s)
- returns
a map of channels to number of subscribers for every provided channel
- Definition Classes
- PubSubCommands
- Since
2.8.0
- def publish[W](channel: String, message: W)(implicit arg0: Writer[W]): Future[Long]
Publishes a message to a channel.
Publishes a message to a channel.
- channel
the name of the channel
- message
the message payload
- returns
the number of clients that received the message
- Definition Classes
- PubSubCommands
- Since
2.0.0
- def rPop[R](key: String)(implicit arg0: Reader[R]): Future[Option[R]]
Removes and returns the last element of a list.
Removes and returns the last element of a list.
- key
list key
- returns
the popped element, or
None
if the key does not exist
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
- def rPopLPush[R](sourceKey: String, destKey: String)(implicit arg0: Reader[R]): Future[Option[R]]
Removes the last element in a list, appends it to another list and returns it.
Removes the last element in a list, appends it to another list and returns it.
- sourceKey
key of list to be pop from
- destKey
key of list to be push to
- returns
the popped element, or
None
if the key does not exist
- Definition Classes
- ListCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
- def rPush[W](key: String, values: W*)(implicit arg0: Writer[W]): Future[Long]
Appends one or multiple values to a list.
Appends one or multiple values to a list.
- key
list key
- values
value(s) to prepend
- returns
the length of the list after the push operations
- Definition Classes
- ListCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value- Note
If key does not exist, it is created as empty list before performing the push operation. Redis versions older than 2.4 can only push one value per call.
- def rPushX[W](key: String, value: W)(implicit arg0: Writer[W]): Future[Long]
Appends a value to a list, only if the list exists.
Appends a value to a list, only if the list exists.
- key
list key
- value
value to prepend
- returns
the length of the list after the push operation
- Definition Classes
- ListCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a non-list value
- def randomKey(): Future[Option[String]]
Returns a random key from the keyspace.
Returns a random key from the keyspace.
- returns
the random key or
None
when the database is empty associated timeout
- Definition Classes
- KeyCommands
- Since
1.0.0
- def rename(key: String, newKey: String): Future[Unit]
Renames a key.
Renames a key.
- key
source key
- newKey
destination key
- Definition Classes
- KeyCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the source and destination keys are the same, or when key does not exist- Note
if newKey already exists, it is overwritten
- def renameNX(key: String, newKey: String): Future[Boolean]
Renames a key, only if the new key does not exist.
Renames a key, only if the new key does not exist.
- key
source key
- newKey
destination key
- returns
true if key was renamed to newKey, false if newKey already exists
- Definition Classes
- KeyCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the source and destination keys are the same, or when key does not exist
- def restore[W](key: String, serializedValue: W, ttlOpt: Option[FiniteDuration] = None)(implicit arg0: Writer[W]): Future[Unit]
Creates a key using the provided serialized value, previously obtained using DUMP.
Creates a key using the provided serialized value, previously obtained using DUMP.
- key
destination key
- serializedValue
serialized value, previously obtained using DUMP
- ttlOpt
optional time-to-live duration of newly created key (expire)
- Definition Classes
- KeyCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the value could not be restored
- def sAdd[W](key: String, members: W*)(implicit arg0: Writer[W]): Future[Long]
Adds one or more members to a set.
Adds one or more members to a set.
- key
set key
- members
member(s) to add
- returns
the number of members added to the set, not including all the members that were already present
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
- def sCard(key: String): Future[Long]
Returns the number of members in a set.
Returns the number of members in a set.
- key
set key
- returns
the cardinality (number of members) of the set, or 0 if key does not exist
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
- def sDiff[R](key: String, keys: String*)(implicit arg0: Reader[R]): Future[Set[R]]
Returns the set resulting from the difference between the first set and all the successive sets.
Returns the set resulting from the difference between the first set and all the successive sets.
- key
the key of the first set
- keys
key(s) of successive set(s) whose members will be substracted from the first one
- returns
the resulting set, or the empty set if the first key does not exist
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
- def sDiffStore(destKey: String, key: String, keys: String*): Future[Long]
Stores the set resulting from the difference between the first set and all the successive sets.
Stores the set resulting from the difference between the first set and all the successive sets.
- destKey
key where to store the resulting set
- key
key of first set
- keys
keys of sets to be substracted from first set, if empty, first set is simply copied to destKey
- returns
the cardinality of the resulting set
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set- Note
If destKey already exists, it is overwritten.
- def sInter[R](keys: String*)(implicit arg0: Reader[R]): Future[Set[R]]
Intersects multiple sets.
Intersects multiple sets.
- keys
keys of sets to be intersected together
- returns
the resulting set, or the empty set if the first key does not exist
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
- def sInterStore(destKey: String, keys: String*): Future[Long]
Intersects multiple sets and stores the resulting set in a key.
Intersects multiple sets and stores the resulting set in a key.
- destKey
key where to store the resulting set
- keys
keys of sets to be intersected together, if only one is specified, it is simply copied to destKey
- returns
the cardinality of the resulting set
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set- Note
If destKey already exists, it is overwritten.
- def sIsMember[W](key: String, member: W)(implicit arg0: Writer[W]): Future[Boolean]
Determines if a given value is a member of a set.
Determines if a given value is a member of a set.
- key
set key
- member
value to be tested
- returns
true if the provided value is a member of the set stored at key, false otherwise
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
- def sMembers[R](key: String)(implicit arg0: Reader[R]): Future[Set[R]]
Returns all the members of a set.
Returns all the members of a set.
- key
set key
- returns
set stored at key, or the empty set if key does not exist
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
- def sMove[W](sourceKey: String, destKey: String, member: W)(implicit arg0: Writer[W]): Future[Boolean]
Moves a member from one set to another.
Moves a member from one set to another.
- sourceKey
key of source set
- member
value to be moved from source set to destination set
- returns
true if the member was moved, false if the element is not a member of source set and no operation was performed
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if sourceKey or destKey contains a value that is not a set
- def sPop[R](key: String)(implicit arg0: Reader[R]): Future[Option[R]]
Removes and returns a random member from a set.
Removes and returns a random member from a set.
- key
set key
- returns
random member, or
None
if key does not exist
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set- Note
This operation is similar to SRANDMEMBER, that returns a random element from a set but does not remove it.
- def sPopCount[R](key: String, count: Int)(implicit arg0: Reader[R]): Future[List[R]]
Removes and returns a random 'count' members from a set.
Removes and returns a random 'count' members from a set.
- key
set key
- count
maximum number of returned elements
- returns
list of random members which size is less or equal to 'count'
- Definition Classes
- SetCommands
- Since
3.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set- Note
This operation is similar to SRANDMEMBER, that returns a random element from a set but does not remove it.
- See also
- def sRandMember[R](key: String)(implicit arg0: Reader[R]): Future[Option[R]]
Returns a random member from a set (without removing it).
Returns a random member from a set (without removing it).
- key
set key
- returns
random member, or
None
if key does not exist
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
- def sRandMembers[R](key: String, count: Int = 1)(implicit arg0: Reader[R]): Future[Set[R]]
Returns a random member from a set (without removing it).
Returns a random member from a set (without removing it).
- key
set key
- count
number of member to randomly retrieve
- returns
set of random members, or the empty set if key does not exist
- Definition Classes
- SetCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set
- def sRem[W](key: String, members: W*)(implicit arg0: Writer[W]): Future[Long]
Removes one or more members from a set.
Removes one or more members from a set.
- key
set key
- members
members to remove from set
- returns
the number of members that were removed from the set, not including non-existing members
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a set- Note
Redis versions older than 2.4 can only remove one member per call.
- def sScan[R](key: String, cursor: Long, matchOpt: Option[String] = None, countOpt: Option[Int] = None)(implicit arg0: Reader[R]): Future[(Long, Set[R])]
Incrementally iterates the elements of a set.
Incrementally iterates the elements of a set.
- cursor
the offset
- matchOpt
when defined, the command only returns elements matching the pattern
- countOpt
when defined, provides a hint of how many elements should be returned
- returns
a pair containing the next cursor as its first element and the set of elements as its second element
- Definition Classes
- SetCommands
- Since
2.8.0
- def sUnion[R](keys: String*)(implicit arg0: Reader[R]): Future[Set[R]]
Computes the union of multiple sets.
Computes the union of multiple sets.
- keys
keys of sets to be included in the union computation
- returns
the resulting set, or the empty set if the first key does not exist
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set
- def sUnionStore(destKey: String, keys: String*): Future[Long]
Computes the union of multiple sets and stores the resulting set in a key.
Computes the union of multiple sets and stores the resulting set in a key.
- destKey
key where to store the resulting set
- keys
keys of sets to be included in the union computation, if only one is specified, it is simply copied to destKey
- returns
the cardinality of the resulting set
- Definition Classes
- SetCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if some keys contain a value that is not a set- Note
If destKey already exists, it is overwritten.
- def scan(cursor: Long, matchOpt: Option[String] = None, countOpt: Option[Int] = None): Future[(Long, Set[String])]
Incrementally iterates the set of keys in the currently selected Redis database.
Incrementally iterates the set of keys in the currently selected Redis database.
- cursor
the offset
- matchOpt
when defined, the command only returns elements matching the pattern
- countOpt
when defined, provides a hint of how many elements should be returned
- returns
a pair containing the next cursor as its first element and the set of keys as its second element
- Definition Classes
- KeyCommands
- Since
2.8.0
- def scriptExists(sha1s: String*): Future[Map[String, Boolean]]
Checks existence of scripts in the script cache.
Checks existence of scripts in the script cache.
- sha1s
SHA1 digest(s) to check for existence
- returns
SHA1 -> Boolean
Map
where true means the script associated to the sha1 exists in the cache
- Definition Classes
- ScriptingCommands
- Since
2.6.0
- def scriptFlush(): Future[Unit]
Removes all the scripts from the script cache.
Removes all the scripts from the script cache.
- Definition Classes
- ScriptingCommands
- Since
2.6.0
- def scriptKill(): Future[Unit]
Kills the currently executing Lua script, assuming no write operation was yet performed by the script.
Kills the currently executing Lua script, assuming no write operation was yet performed by the script.
- Definition Classes
- ScriptingCommands
- Since
2.6.0
- Note
If the script already performed write operations it can not be killed in this way because it would violate Lua script atomicity contract. In such a case only SHUTDOWN NOSAVE is able to kill the script, killing the Redis process in an hard way preventing it to persist with half-written information.
- def scriptLoad(script: String): Future[String]
Loads or stores the specified Lua script into the script cache.
Loads or stores the specified Lua script into the script cache.
- script
the script to be loaded into the cache
- returns
the SHA1 digest of the stored script
- Definition Classes
- ScriptingCommands
- Since
2.6.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if a compilation error occurs- Note
The script is guaranteed to stay in the script cache forever (unless SCRIPT FLUSH is called).
- def send[A](request: Request[A]): Future[A]
- Attributes
- protected[scredis]
- Definition Classes
- ClusterConnection → NonBlockingConnection
- def set[W](key: String, value: W, ttlOpt: Option[FiniteDuration] = None, conditionOpt: Option[Condition] = None)(implicit arg0: Writer[W]): Future[Boolean]
Sets the string value of a key.
Sets the string value of a key.
- key
target key to set
- value
value to be stored at key
- ttlOpt
optional time-to-live (up to milliseconds precision)
- conditionOpt
optional condition to be met for the value to be set
- returns
true if the value was set correctly, false if a condition was specified but not met
- Definition Classes
- StringCommands
- Since
1.0.0
- Note
If key already holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on successful SET operation. The ttlOpt and conditionOpt parameters can only be used with
Redis
>= 2.6.12
- def setBit(key: String, offset: Long, bit: Boolean): Future[Boolean]
Sets or clears the bit at offset in the string value stored at key.
Sets or clears the bit at offset in the string value stored at key.
- key
key for which the bit should be set
- offset
position where the bit should be set
- bit
true sets the bit to 1, false sets it to 0
- Definition Classes
- StringCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type- Note
When key does not exist, a new string value is created. The string is grown to make sure it can hold a bit at offset. When the string at key is grown, added bits are set to 0.
- def setEX[W](key: String, value: W, ttlSeconds: Int)(implicit arg0: Writer[W]): Future[Unit]
Sets the value and expiration in seconds of a key.
Sets the value and expiration in seconds of a key.
- key
target key to set
- value
value to be stored at key
- ttlSeconds
time-to-live in seconds
- Definition Classes
- StringCommands
- Since
2.0.0
- Note
If key already holds a value, it is overwritten, regardless of its type.
- def setNX[W](key: String, value: W)(implicit arg0: Writer[W]): Future[Boolean]
Sets the value of a key, only if the key does not exist.
Sets the value of a key, only if the key does not exist.
- key
target key to set
- value
value to be stored at key
- returns
true if the key was set, false otherwise
- Definition Classes
- StringCommands
- Since
1.0.0
- def setRange[W](key: String, offset: Long, value: W)(implicit arg0: Writer[W]): Future[Long]
Overwrites part of a string at key starting at the specified offset.
Overwrites part of a string at key starting at the specified offset.
- key
target key
- offset
position from which the string must be overwritten
- value
string value to be set at given offset
- returns
the length of the string after it was modified by the command
- Definition Classes
- StringCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type- Note
If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset.
- def sort[R](key: String, byOpt: Option[String] = None, limitOpt: Option[(Long, Long)] = None, get: Iterable[String] = Nil, desc: Boolean = false, alpha: Boolean = false)(implicit arg0: Reader[R]): Future[List[Option[R]]]
Sorts the elements of a list, set or sorted set.
Sorts the elements of a list, set or sorted set.
- key
key of list, set or sorted set to be sorted
- byOpt
optional pattern for sorting by external values, can also be "nosort" if the sorting operation should be skipped (useful when only sorting to retrieve objects with get). The * gets replaced by the values of the elements in the collection
- limitOpt
optional pair of numbers (offset, count) where offset specified the number of elements to skip and count specifies the number of elements to return starting from offset
- get
list of patterns for retrieving objects stored in external keys. The * gets replaced by the values of the elements in the collection
- desc
indicates whether elements should be sorted descendingly
- alpha
indicates whether elements should be sorted lexicographically
- returns
the sorted list of elements, or the empty list if the key does not exist
- Definition Classes
- KeyCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
whenever an error occurs
- def sortAndStore(key: String, targetKey: String, byOpt: Option[String] = None, limitOpt: Option[(Long, Long)] = None, get: Iterable[String] = Nil, desc: Boolean = false, alpha: Boolean = false): Future[Long]
Sorts the elements of a list, set or sorted set and then store the result.
Sorts the elements of a list, set or sorted set and then store the result.
- key
key of list, set or sorted set to be sorted
- targetKey
key of list, set or sorted set to be sorted
- byOpt
optional pattern for sorting by external values, can also be "nosort" if the sorting operation should be skipped (useful when only sorting to retrieve objects with get). The * gets replaced by the values of the elements in the collection
- limitOpt
optional pair of numbers (offset, count) where offset specified the number of elements to skip and count specifies the number of elements to return starting from offset
- get
list of patterns for retrieving objects stored in external keys. The * gets replaced by the values of the elements in the collection
- desc
indicates whether elements should be sorted descendingly
- alpha
indicates whether elements should be sorted lexicographically
- returns
the number of elements in the newly stored sorted collection
- Definition Classes
- KeyCommands
- Since
1.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
whenever an error occurs
- def strLen(key: String): Future[Long]
Returns the length of the string value stored in a key.
Returns the length of the string value stored in a key.
- key
target key
- returns
the length of the string stored at key, or 0 when the key does not exist
- Definition Classes
- StringCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if the key contains a value of the wrong type
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def ttl(key: String): Future[Either[Boolean, Int]]
Gets the time to live for a key in seconds.
Gets the time to live for a key in seconds.
result match { case Left(false) => // key does not exist case Left(true) => // key exists but has no associated expire case Right(ttl) => }
- key
the target key
- returns
Right(ttl)
where ttl is the time-to-live in seconds for specified key,Left(false)
if key does not exist orLeft(true)
if key exists but has no associated expire
- Definition Classes
- KeyCommands
- Since
1.0.0
- Note
For
Redis
version <= 2.8.x,Left(false)
will be returned when the key does not exists and when it exists but has no associated expire (Redis
returns the same error code for both cases). In other words, you can simply check the followingresult match { case Left(_) => case Right(ttl) => }
- def type(key: String): Future[Option[Type]]
Determine the type stored at key.
Determine the type stored at key.
- key
key for which the type should be returned
- returns
type of key, or
None
if key does not exist
- Definition Classes
- KeyCommands
- Since
1.0.0
- Note
This method needs to be called as follows:
client.`type`(key)
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def zAdd[W](key: String, members: Map[W, Score])(implicit arg0: Writer[W]): Future[Long]
Adds one or more members to a sorted set, or update its score if it already exists.
Adds one or more members to a sorted set, or update its score if it already exists.
- key
sorted set key
- members
member-score pairs to be added
- returns
the number of elements added to the sorted sets, not including elements already existing for which the score was updated
- Definition Classes
- SortedSetCommands
- Since
2.4
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
- def zAdd[W](key: String, member: W, score: Score)(implicit arg0: Writer[W]): Future[Boolean]
Adds a member to a sorted set, or update its score if it already exists.
Adds a member to a sorted set, or update its score if it already exists.
- key
sorted set key
- member
member to add
- score
score of the member to add
- returns
true if the member was added, or false if the member already exists
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
If a specified member is already a member of the sorted set, the score is updated and the element reinserted at the right position to ensure the correct ordering.
- def zCard(key: String): Future[Long]
Returns the number of members in a sorted set.
Returns the number of members in a sorted set.
- key
sorted set key
- returns
the cardinality (number of elements) of the sorted set, or 0 if key does not exist
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zCount(key: String, min: ScoreLimit, max: ScoreLimit): Future[Long]
Returns the number of elements of a sorted set belonging to a given score range.
Returns the number of elements of a sorted set belonging to a given score range.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- returns
the number of elements in the specified score range
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zIncrBy[W](key: String, member: W, increment: Double)(implicit arg0: Writer[W]): Future[Double]
Increments the score of a member in a sorted set.
Increments the score of a member in a sorted set.
- key
sorted set key
- member
member whose score needs to be incremented
- increment
the increment
- returns
the new score of member
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zInterStore(destKey: String, keys: Seq[String], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
- destKey
sorted set key
- keys
keys of sorted sets to intersect
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zInterStoreWeighted(destKey: String, keysWeightPairs: Map[String, Double], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
Intersects multiple sorted sets and stores the resulting sorted set in a new key.
- destKey
sorted set key
- keysWeightPairs
key to weight pairs
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zLexCount(key: String, min: LexicalScoreLimit, max: LexicalScoreLimit): Future[Long]
Returns the number of elements of a sorted set belonging to a given lexical score range.
Returns the number of elements of a sorted set belonging to a given lexical score range.
- key
sorted set key
- min
lexical score lower bound
- max
lexical score upper bound
- returns
the number of elements in the specified lexical score range
- Definition Classes
- SortedSetCommands
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
- def zRange[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by index.
Returns a range of members in a sorted set, by index.
- key
sorted set key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- returns
the set of ascendingly ordered elements in the specified range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next element and so on. They can also be negative numbers indicating offsets from the end of the sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and so on. Out of range indexes will not produce an error. If start is larger than the largest index in the sorted set, or
start
>end
, an empty list is returned. Ifend
is larger than the end of the sorted set Redis will treat it like it is the last element of the sorted set. The indexes are inclusive.
- def zRangeByLex[R](key: String, min: LexicalScoreLimit, max: LexicalScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by lexical score.
Returns a range of members in a sorted set, by lexical score.
- key
sorted set key
- min
lexical score lower bound
- max
lexical score upper bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of ascendingly ordered elements in the specified lexical range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
- def zRangeByScore[R](key: String, min: ScoreLimit, max: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by score.
Returns a range of members in a sorted set, by score.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of ascendingly ordered elements in the specified score range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
The elements having the same score are returned in lexicographical order (this follows from a property of the sorted set implementation in Redis and does not involve further computation).
- def zRangeByScoreWithScores[R](key: String, min: ScoreLimit, max: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
Returns a range of members with associated scores in a sorted set, by score.
Returns a range of members with associated scores in a sorted set, by score.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of ascendingly ordered element-score pairs in the specified score range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
The elements having the same score are returned in lexicographical order (this follows from a property of the sorted set implementation in Redis and does not involve further computation).
- def zRangeWithScores[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
Returns a range of members with associated scores in a sorted set, by index.
Returns a range of members with associated scores in a sorted set, by index.
- key
sorted set key
- start
start offset (inclusive)
- stop
end offset (inclusive)
- returns
the set of ascendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next element and so on. They can also be negative numbers indicating offsets from the end of the sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and so on. Out of range indexes will not produce an error. If start is larger than the largest index in the sorted set, or
start
>end
, an empty list is returned. Ifend
is larger than the end of the sorted set Redis will treat it like it is the last element of the sorted set. The indexes are inclusive.
- def zRank[W](key: String, member: W)(implicit arg0: Writer[W]): Future[Option[Long]]
Determines the index of a member in a sorted set.
Determines the index of a member in a sorted set.
- key
sorted set key
- member
the value
- returns
the rank or index of the member, or
None
if the member is not in the set or the key does not exist
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zRem[W](key: String, members: W*)(implicit arg0: Writer[W]): Future[Long]
Removes one or more members from a sorted set.
Removes one or more members from a sorted set.
- key
sorted set key
- members
additional values to be removed (only works with Redis >= 2.4)
- returns
the number of members removed from the sorted set, not including non existing members
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Redis versions older than 2.4 can only remove one value per call.
- def zRemRangeByLex(key: String, min: LexicalScoreLimit, max: LexicalScoreLimit): Future[Long]
Removes all members in a sorted set within the given lexical range.
Removes all members in a sorted set within the given lexical range.
- key
sorted set key
- min
lexical score lower bound
- max
lexical score upper bound
- returns
the number of removed elements
- Definition Classes
- SortedSetCommands
- Since
2.8.9
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Lexical ordering only applies when all the elements in a sorted set are inserted with the same score
- def zRemRangeByRank(key: String, start: Long, stop: Long): Future[Long]
Removes all members in a sorted set within the given indexes.
Removes all members in a sorted set within the given indexes.
- key
sorted set key
- start
the start offset or index (inclusive)
- stop
the stop offset or index (inclusive)
- returns
the number of members removed
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Both start and stop are zero-based inclusive indexes with 0 being the element with the lowest score. These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth.
- def zRemRangeByScore(key: String, min: ScoreLimit, max: ScoreLimit): Future[Long]
Removes all members in a sorted set within the given scores range.
Removes all members in a sorted set within the given scores range.
- key
sorted set key
- min
score lower bound
- max
score upper bound
- returns
the number of members removed
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Since version 2.1.6, min and max can be exclusive, following the syntax of ZRANGEBYSCORE.
- def zRevRange[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
- key
sorted set key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- returns
the set of descendingly ordered elements in the specified range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE.
- def zRevRangeByScore[R](key: String, max: ScoreLimit, min: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[R]]
Returns a range of members in a sorted set, by score, with scores ordered from high to low.
Returns a range of members in a sorted set, by score, with scores ordered from high to low.
- key
sorted set key
- max
score upper bound
- min
score lower bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
- def zRevRangeByScoreWithScores[R](key: String, max: ScoreLimit, min: ScoreLimit, limitOpt: Option[(Long, Int)] = None)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
Return a range of members with associated scores in a sorted set, by score, with scores ordered from high to low.
Return a range of members with associated scores in a sorted set, by score, with scores ordered from high to low.
- key
sorted set key
- max
score upper bound
- min
score lower bound
- limitOpt
optional offset and count pair used to limit the number of matching elements
- returns
the set of descendingly ordered elements in the specified score range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
2.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE. The elements having the same score are returned in reverse lexicographical order.
- def zRevRangeWithScores[R](key: String, start: Long = 0, stop: Long = -1)(implicit arg0: Reader[R]): Future[LinkedHashSet[(R, Score)]]
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
Returns a range of members in a sorted set, by index, with scores ordered from high to low.
- key
sorted set key
- start
start offset (inclusive)
- stop
stop offset (inclusive)
- returns
the set of descendingly ordered elements-score pairs in the specified range, or the empty set if key does not exist
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set- Note
Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE. The elements having the same score are returned in reverse lexicographical order.
- def zRevRank[W](key: String, member: W)(implicit arg0: Writer[W]): Future[Option[Long]]
Determine the index of a member in a sorted set, with scores ordered from high to low.
Determine the index of a member in a sorted set, with scores ordered from high to low.
- key
sorted set key
- member
the value
- returns
the rank or index of the member, or
None
if the member is not in the set or the key does not exist
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zScan[R](key: String, cursor: Long, matchOpt: Option[String] = None, countOpt: Option[Int] = None)(implicit arg0: Reader[R]): Future[(Long, LinkedHashSet[(R, Score)])]
Incrementally iterates the elements (value-score pairs) of a sorted set.
Incrementally iterates the elements (value-score pairs) of a sorted set.
- cursor
the offset
- matchOpt
when defined, the command only returns elements matching the pattern
- countOpt
when defined, provides a hint of how many elements should be returned
- returns
a pair containing the next cursor as its first element and the sorted set of elements (value-score pairs) as its second element
- Definition Classes
- SortedSetCommands
- Since
2.8.0
- def zScore[W](key: String, member: W)(implicit arg0: Writer[W]): Future[Option[Score]]
Returns the score associated with the given member in a sorted set.
Returns the score associated with the given member in a sorted set.
- key
sorted set key
- member
the value
- returns
the score of member, or
None
if the latter is not in the sorted set or the key does not exist
- Definition Classes
- SortedSetCommands
- Since
1.2.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zUnionStore(destKey: String, keys: Seq[String], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
- destKey
sorted set key
- keys
keys of sorted sets
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set
- def zUnionStoreWeighted(destKey: String, keysWeightPairs: Map[String, Double], aggregate: Aggregate = scredis.Aggregate.Sum): Future[Long]
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
Computes the union of multiple sorted sets and stores the resulting sorted set in a new key.
- destKey
sorted set key
- keysWeightPairs
key to weight pairs
- aggregate
aggregation function (default is Sum)
- returns
the number of elements in the resulting sorted set stored at destKey
- Definition Classes
- SortedSetCommands
- Since
2.0.0
- Exceptions thrown
[[scredis.exceptions.RedisErrorResponseException]]
if key contains a value that is not a sorted set