Trait

play.api.cache.redis.connector

RedisConnector

Related Doc: package connector

Permalink

trait RedisConnector extends CoreCommands with ListCommands with SetCommands with HashCommands

Internal non-blocking Redis API implementing REDIS protocol

See also

https://redis.io/commands

Linear Supertypes
HashCommands, SetCommands, ListCommands, CoreCommands, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RedisConnector
  2. HashCommands
  3. SetCommands
  4. ListCommands
  5. CoreCommands
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def append(key: String, value: String): Future[Long]

    Permalink

    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
  2. abstract def exists(key: String): Future[Boolean]

    Permalink

    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
  3. abstract def expire(key: String, expiration: Duration): Future[Unit]

    Permalink

    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
  4. abstract def expiresIn(key: String): Future[Option[Duration]]

    Permalink

    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
  5. abstract def get[T](key: String)(implicit arg0: ClassTag[T]): Future[Option[T]]

    Permalink

    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
  6. abstract def hashExists(key: String, field: String): Future[Boolean]

    Permalink

    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
  7. abstract def hashGet[T](key: String, fields: Seq[String])(implicit arg0: ClassTag[T]): Future[Seq[Option[T]]]

    Permalink

    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
  8. abstract def hashGet[T](key: String, field: String)(implicit arg0: ClassTag[T]): Future[Option[T]]

    Permalink

    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
  9. abstract def hashGetAll[T](key: String)(implicit arg0: ClassTag[T]): Future[Map[String, T]]

    Permalink

    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
  10. abstract def hashIncrement(key: String, field: String, incrementBy: Long): Future[Long]

    Permalink

    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
  11. abstract def hashKeys(key: String): Future[Set[String]]

    Permalink

    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
  12. abstract def hashRemove(key: String, field: String*): Future[Long]

    Permalink

    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
  13. abstract def hashSet(key: String, field: String, value: Any): Future[Boolean]

    Permalink

    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
  14. abstract def hashSize(key: String): Future[Long]

    Permalink

    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
  15. abstract def hashValues[T](key: String)(implicit arg0: ClassTag[T]): Future[Set[T]]

    Permalink

    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
  16. abstract def increment(key: String, by: Long): Future[Long]

    Permalink

    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
  17. abstract def invalidate(): Future[Unit]

    Permalink

    Remove all keys in cache

    Remove all keys in cache

    returns

    promise

    Definition Classes
    CoreCommands
  18. abstract def listAppend(key: String, value: Any*): Future[Long]

    Permalink

    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
  19. abstract def listHeadPop[T](key: String)(implicit arg0: ClassTag[T]): Future[Option[T]]

    Permalink

    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
  20. abstract def listInsert(key: String, pivot: Any, value: Any): Future[Option[Long]]

    Permalink

    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
  21. abstract def listPrepend(key: String, value: Any*): Future[Long]

    Permalink

    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
  22. abstract def listRemove(key: String, value: Any, count: Int): Future[Long]

    Permalink

    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
  23. abstract def listSetAt(key: String, position: Int, value: Any): Future[Unit]

    Permalink

    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
  24. abstract def listSize(key: String): Future[Long]

    Permalink

    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
  25. abstract def listSlice[T](key: String, start: Int, end: Int)(implicit arg0: ClassTag[T]): Future[Seq[T]]

    Permalink

    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
  26. abstract def listTrim(key: String, start: Int, end: Int): Future[Unit]

    Permalink

    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
  27. abstract def mGet[T](keys: String*)(implicit arg0: ClassTag[T]): Future[Seq[Option[T]]]

    Permalink

    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
  28. abstract def mSet(keyValues: (String, Any)*): Future[Unit]

    Permalink

    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
  29. abstract def mSetIfNotExist(keyValues: (String, Any)*): Future[Boolean]

    Permalink

    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
  30. abstract def matching(pattern: String): Future[Seq[String]]

    Permalink

    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
  31. abstract def ping(): Future[Unit]

    Permalink

    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
  32. abstract def remove(keys: String*): Future[Unit]

    Permalink

    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
  33. abstract def set(key: String, value: Any, expiration: Duration = Duration.Inf, ifNotExists: Boolean = false): Future[Boolean]

    Permalink

    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
  34. abstract def setAdd(key: String, value: Any*): Future[Long]

    Permalink

    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.

  35. abstract def setIsMember(key: String, value: Any): Future[Boolean]

    Permalink

    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
  36. abstract def setMembers[T](key: String)(implicit arg0: ClassTag[T]): Future[Set[T]]

    Permalink

    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
  37. abstract def setRemove(key: String, value: Any*): Future[Long]

    Permalink

    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
  38. abstract def setSize(key: String): Future[Long]

    Permalink

    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

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from HashCommands

Inherited from SetCommands

Inherited from ListCommands

Inherited from CoreCommands

Inherited from AnyRef

Inherited from Any

Ungrouped