trait RedisConnector extends CoreCommands with ListCommands with SetCommands with HashCommands
Internal non-blocking Redis API implementing REDIS protocol
- See also
https://redis.io/commands
- Alphabetic
- By Inheritance
- RedisConnector
- HashCommands
- SetCommands
- ListCommands
- CoreCommands
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def append(key: String, value: String): Future[Long]
If key already exists and is a string, this command appends the value at the end of the string.
If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.
- key
cache storage key
- value
value to be appended
- returns
number of characters of current value
- Definition Classes
- CoreCommands
- abstract def exists(key: String): Future[Boolean]
Determines whether value exists in cache.
Determines whether value exists in cache.
- key
cache storage key
- returns
record existence, true if exists, otherwise false
- Definition Classes
- CoreCommands
- abstract def expire(key: String, expiration: Duration): Future[Unit]
refreshes expiration time on a given key, useful, e.g., when we want to refresh session duration
refreshes expiration time on a given key, useful, e.g., when we want to refresh session duration
- key
cache storage key
- expiration
new expiration in seconds
- returns
promise
- Definition Classes
- CoreCommands
- abstract def expiresIn(key: String): Future[Option[Duration]]
returns the remaining time to live of a key that has an expire set, useful, e.g., when we want to check remaining session duration
returns the remaining time to live of a key that has an expire set, useful, e.g., when we want to check remaining session duration
- key
cache storage key
- returns
the remaining time to live of a key in milliseconds
- Definition Classes
- CoreCommands
- abstract def get[T](key: String)(implicit arg0: ClassTag[T]): Future[Option[T]]
Retrieve a value from the cache.
Retrieve a value from the cache.
- key
cache storage key
- returns
stored record, Some if exists, otherwise None
- Definition Classes
- CoreCommands
- abstract def hashExists(key: String, field: String): Future[Boolean]
Returns if field is an existing field in the hash stored at key.
Returns if field is an existing field in the hash stored at key.
Time complexity: O(1)
- key
cache storage key
- field
tested field name
- returns
true if the field exists, false otherwise
- Definition Classes
- HashCommands
- abstract def hashGet[T](key: String, fields: Seq[String])(implicit arg0: ClassTag[T]): Future[Seq[Option[T]]]
Returns the values associated with fields in the hash stored at given keys.
Returns the values associated with fields in the hash stored at given keys.
Time complexity: O(n), where n is number of fields
- key
cache storage key
- fields
accessed fields to get
- returns
Some value if the field exists, otherwise None
- Definition Classes
- HashCommands
- abstract def hashGet[T](key: String, field: String)(implicit arg0: ClassTag[T]): Future[Option[T]]
Returns the value associated with field in the hash stored at key.
Returns the value associated with field in the hash stored at key.
Time complexity: O(1)
- key
cache storage key
- field
accessed field
- returns
Some value if the field exists, otherwise None
- Definition Classes
- HashCommands
- abstract def hashGetAll[T](key: String)(implicit arg0: ClassTag[T]): Future[Map[String, T]]
Returns all fields and values of the hash stored at key.
Returns all fields and values of the hash stored at key. In the returned value, every field name is followed by its value, so the length of the reply is twice the size of the hash.
Time complexity: O(N) where N is the size of the hash.
- T
expected type of the elements
- key
cache storage key
- returns
the stored map
- Definition Classes
- HashCommands
- abstract def hashIncrement(key: String, field: String, incrementBy: Long): Future[Long]
Increment a value at the given key in the map
Increment a value at the given key in the map
- key
cache storage key
- field
key
- incrementBy
increment by this
- returns
value after incrementation
- Definition Classes
- HashCommands
- abstract def hashKeys(key: String): Future[Set[String]]
Returns all field names in the hash stored at key.
Returns all field names in the hash stored at key.
Time complexity: O(N) where N is the size of the hash.
- key
cache storage key
- returns
set of field names
- Definition Classes
- HashCommands
- abstract def hashRemove(key: String, field: String*): Future[Long]
Removes the specified fields from the hash stored at key.
Removes the specified fields from the hash stored at 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.
Time complexity: O(N) where N is the number of fields to be removed.
- key
cache storage key
- field
fields to be removed
- returns
the number of fields that were removed from the hash, not including specified but non existing fields.
- Definition Classes
- HashCommands
- abstract def hashSet(key: String, field: String, value: Any): Future[Boolean]
Sets field in the hash stored at key to value.
Sets field in the hash stored at key to value. If key does not exist, a new key holding a hash is created. If field already exists in the hash, it is overwritten.
Time complexity: O(1)
- key
cache storage key
- field
field to be set
- value
value to be set
- returns
true if the field was newly set, false if was updated
- Definition Classes
- HashCommands
- abstract def hashSize(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.
Time complexity: O(1)
- key
cache storage key
- returns
size of the hash
- Definition Classes
- HashCommands
- abstract def hashValues[T](key: String)(implicit arg0: ClassTag[T]): Future[Set[T]]
Returns all values in the hash stored at key.
Returns all values in the hash stored at key.
Time complexity: O(N) where N is the size of the hash.
- key
cache storage key
- returns
all values in the hash object
- Definition Classes
- HashCommands
- abstract def increment(key: String, by: Long): Future[Long]
Increments the stored string value representing 10-based signed integer by given value.
Increments the stored string value representing 10-based signed integer by given value.
- key
cache storage key
- by
size of increment
- returns
the value after the increment
- Definition Classes
- CoreCommands
- abstract def invalidate(): Future[Unit]
Remove all keys in cache
Remove all keys in cache
- returns
promise
- Definition Classes
- CoreCommands
- abstract def listAppend(key: String, value: Any*): Future[Long]
Insert (RPUSH) all the specified values at the tail of the list stored at key.
Insert (RPUSH) all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned.
Time complexity: O(1)
- key
cache storage key
- value
appended values
- returns
new length of the list
- Definition Classes
- ListCommands
- abstract def listHeadPop[T](key: String)(implicit arg0: ClassTag[T]): Future[Option[T]]
Removes and returns the first element of the list stored at key (LPOP).
Removes and returns the first element of the list stored at key (LPOP).
Time complexity: O(1)
- T
type of the value
- key
cache storage key
- returns
head of the list, if existed
- Definition Classes
- ListCommands
- abstract def listInsert(key: String, pivot: Any, value: Any): Future[Option[Long]]
Inserts value in the list stored at key either before or after the reference value pivot.
Inserts value in the list stored at key either before or after the reference value pivot. When key does not exist, it is considered an empty list and no operation is performed. An error is returned when key exists but does not hold a list value.
Time complexity: O(N) where N is the number of elements to traverse before seeing the value pivot.
- key
cache storage key
- pivot
value used as markup
- value
value to be inserted
- returns
the length of the list after the insert operation, or None when the value pivot was not found.
- Definition Classes
- ListCommands
- abstract def listPrepend(key: String, value: Any*): Future[Long]
Insert (LPUSH) all the specified values at the head of the list stored at key.
Insert (LPUSH) all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.
Time complexity: O(1)
- key
cache storage key
- value
prepended values
- returns
new length of the list
- Definition Classes
- ListCommands
- abstract def listRemove(key: String, value: Any, count: Int): Future[Long]
Removes (LREM) the first count occurrences of elements equal to value from the list stored at key.
Removes (LREM) the first count occurrences of elements equal to value from the list stored at key. 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.
- key
cache storage key
- value
value to be removed
- count
number of elements to be removed
- returns
number of removed elements
- Definition Classes
- ListCommands
- abstract def listSetAt(key: String, position: Int, value: Any): Future[Unit]
Sets the list element at index to value.
Sets the list element at index to value. For more information on the index argument, see LINDEX. An error is returned for out of range indexes.
Time complexity: O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).
- key
cache storage key
- position
position to be overwritten
- value
value to be set
- returns
promise
- Definition Classes
- ListCommands
- abstract def listSize(key: String): Future[Long]
Returns the length of the list stored at key (LLEN).
Returns the length of the list stored at key (LLEN). If key does not exist, it is interpreted as an empty list and 0 is returned. An error is returned when the value stored at key is not a list.
Time complexity: O(1)
- key
cache storage key
- returns
length of the list
- Definition Classes
- ListCommands
- abstract def listSlice[T](key: String, start: Int, end: Int)(implicit arg0: ClassTag[T]): Future[Seq[T]]
Returns the specified elements of the list stored at key (LRANGE).
Returns the specified elements of the list stored at key (LRANGE). The offsets start and stop 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.
Time complexity: O(S+N) where S is the distance of start offset from HEAD for small lists, from nearest end (HEAD or TAIL) for large lists; and N is the number of elements in the specified range.
- T
type of the values
- key
cache storage key
- start
initial index of the subset
- end
last index of the subset (included)
- returns
subset of existing set
- Definition Classes
- ListCommands
- abstract def listTrim(key: String, start: Int, end: Int): Future[Unit]
Trim an existing list so that it will contain only the specified range of elements specified.
Trim an existing list so that it will contain only the specified range of elements specified. Both start and stop are zero-based indexes, where 0 is the first element of the list (the head), 1 the next element and so on.
For example: LTRIM foobar 0 2 will modify the list stored at foobar so that only the first three elements of the list will remain. start and end can also be negative numbers indicating offsets from the end of the list, where -1 is the last element of the list, -2 the penultimate element and so on.
Time complexity: O(N) where N is the number of elements to be removed by the operation.
- key
cache storage key
- start
initial index of preserved subset
- end
last index of preserved subset (included)
- returns
promise
- Definition Classes
- ListCommands
- abstract def mGet[T](keys: String*)(implicit arg0: ClassTag[T]): Future[Seq[Option[T]]]
Retrieve a values from the cache.
Retrieve a values from the cache.
- keys
cache storage key
- returns
stored record, Some if exists, otherwise None
- Definition Classes
- CoreCommands
- abstract def mSet(keyValues: (String, Any)*): Future[Unit]
Set a value into the cache.
Set a value into the cache. Expiration time is the eternity.
- keyValues
cache storage key-value pairs to store
- returns
promise
- Definition Classes
- CoreCommands
- abstract def mSetIfNotExist(keyValues: (String, Any)*): Future[Boolean]
Set a value into the cache.
Set a value into the cache. Expiration time is the eternity. It either set all values or it sets none if any of them already exists.
- keyValues
cache storage key-value pairs to store
- returns
promise
- Definition Classes
- CoreCommands
- abstract def matching(pattern: String): Future[Seq[String]]
Retrieves all keys matching the given pattern.
Retrieves all keys matching the given pattern. This method invokes KEYS command
Warning: complexity is O(n) where n are all keys in the database
- pattern
valid KEYS pattern with wildcards
- returns
list of matching keys
- Definition Classes
- CoreCommands
- abstract def ping(): Future[Unit]
Sends PING command to REDIS and expects PONG in return
Sends PING command to REDIS and expects PONG in return
- returns
promise
- Definition Classes
- CoreCommands
- abstract def remove(keys: String*): Future[Unit]
Removes all keys in arguments.
Removes all keys in arguments. The other remove methods are for syntax sugar
- keys
cache storage keys
- returns
promise
- Definition Classes
- CoreCommands
- abstract def set(key: String, value: Any, expiration: Duration = Duration.Inf, ifNotExists: Boolean = false): Future[Boolean]
Set a value into the cache.
Set a value into the cache. Expiration time in seconds (0 second means eternity).
- key
cache storage key
- value
value to store
- expiration
record duration in seconds
- ifNotExists
set only if the key does not exist
- returns
promise
- Definition Classes
- CoreCommands
- abstract def setAdd(key: String, value: Any*): Future[Long]
Add the specified members to the set stored at key.
Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.
An error is returned when the value stored at key is not a set.
- key
cache storage key
- value
values to be added
- returns
number of inserted elements ignoring already existing
- Definition Classes
- SetCommands
- Note
Time complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.
- abstract def setIsMember(key: String, value: Any): Future[Boolean]
Returns if member is a member of the set stored at key.
Returns if member is a member of the set stored at key.
Time complexity: O(1)
- key
cache storage key
- value
tested element
- returns
true if the element exists in the set, otherwise false
- Definition Classes
- SetCommands
- abstract def setMembers[T](key: String)(implicit arg0: ClassTag[T]): Future[Set[T]]
Returns all the members of the set value stored at key.
Returns all the members of the set value stored at key.
This has the same effect as running SINTER with one argument key.
Time complexity: O(N) where N is the set cardinality.
- T
expected type of the elements
- key
cache storage key
- returns
the subset
- Definition Classes
- SetCommands
- abstract def setRemove(key: String, value: Any*): Future[Long]
Remove the specified members from the set stored at key.
Remove the specified members from the set stored at key. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns 0.
An error is returned when the value stored at key is not a set.
Time complexity: O(N) where N is the number of members to be removed.
- key
cache storage key
- value
values to be removed
- returns
total number of removed values, non existing are ignored
- Definition Classes
- SetCommands
- abstract def setSize(key: String): Future[Long]
Returns the set cardinality (number of elements) of the set stored at key.
Returns the set cardinality (number of elements) of the set stored at key.
Time complexity: O(1)
- key
cache storage key
- returns
the cardinality (number of elements) of the set, or 0 if key does not exist.
- Definition Classes
- SetCommands
Concrete 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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.