Packages

t

play.cache.redis

AsyncCacheApi

trait AsyncCacheApi extends cache.AsyncCacheApi

Cache API inspired by basic Play play.api.cache.CacheApi. It implements all its operations and in addition it declares couple more useful operations handful with cache storage.

Since

2.5.0

Linear Supertypes
cache.AsyncCacheApi, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AsyncCacheApi
  2. AsyncCacheApi
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def append(key: String, value: String, expiration: Int): CompletionStage[Done]

    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.

    If it sets new value, it subsequently calls EXPIRE to set required expiration time

    key

    cache storage key

    value

    value to append

    expiration

    record duration, applies only when appends to nothing

    returns

    promise

  2. abstract def append(key: String, value: String): CompletionStage[Done]

    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.

    If it sets new value, it subsequently calls EXPIRE to set required expiration time

    key

    cache storage key

    value

    value to append

    returns

    promise

  3. abstract def decrement(key: String, by: Long): CompletionStage[Long]

    Decrements the stored string value representing 10-based signed integer by given value.

    Decrements the stored string value representing 10-based signed integer by given value.

    key

    cache storage key

    by

    size of decrement

    returns

    the value after the decrement

  4. abstract def exists(key: String): CompletionStage[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

  5. abstract def expire(key: String, expiration: Int): CompletionStage[Done]

    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

  6. abstract def expiresIn(key: String): CompletionStage[Optional[Long]]

    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. Some finite duration when the value exists and the expiration is set, Some infinite duration when the value exists but never expires, and None when the key does not exist.

  7. abstract def get[T <: AnyRef](arg0: String): CompletionStage[Optional[T]]
    Definition Classes
    AsyncCacheApi
  8. abstract def getAll[T](classTag: Class[T], keys: List[String]): CompletionStage[List[Optional[T]]]

    Retrieve the values of all specified keys from the cache.

    Retrieve the values of all specified keys from the cache.

    classTag

    class to be parsed from the redis

    keys

    cache storage keys

    returns

    stored record, Some if exists, otherwise None

  9. abstract def getOrElse[T](key: String, block: Callable[T], expiration: Int): CompletionStage[T]

    Retrieve a value from the cache, or set it from a default Callable function.

    Retrieve a value from the cache, or set it from a default Callable function.

    key

    Item key.

    block

    block returning value to set if key does not exist

    expiration

    expiration period in seconds.

    returns

    a CompletionStage containing the value

  10. abstract def getOrElse[T](key: String, block: Callable[T]): CompletionStage[T]

    Retrieve a value from the cache, or set it from a default Callable function.

    Retrieve a value from the cache, or set it from a default Callable function.

    key

    Item key.

    block

    block returning value to set if key does not exist

    returns

    a CompletionStage containing the value

  11. abstract def getOrElseUpdate[T <: AnyRef](arg0: String, arg1: Callable[CompletionStage[T]]): CompletionStage[T]
    Definition Classes
    AsyncCacheApi
  12. abstract def getOrElseUpdate[T <: AnyRef](arg0: String, arg1: Callable[CompletionStage[T]], arg2: Int): CompletionStage[T]
    Definition Classes
    AsyncCacheApi
  13. abstract def increment(key: String, by: Long): CompletionStage[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

  14. abstract def list[T](key: String, classTag: Class[T]): AsyncRedisList[T]

    Scala wrapper around Redis list-related commands.

    Scala wrapper around Redis list-related commands. This simplifies use of the lists.

    key

    the key storing the list

    classTag

    class to be parsed from the redis

    returns

    Scala wrapper

  15. abstract def map[T](key: String, classTag: Class[T]): AsyncRedisMap[T]

    Scala wrapper around Redis hash-related commands.

    Scala wrapper around Redis hash-related commands. This simplifies use of the hashes, i.e., maps.

    key

    the key storing the map

    classTag

    class to be parsed from the redis

    returns

    Scala wrapper

  16. abstract def matching(pattern: String): CompletionStage[List[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

  17. abstract def remove(key1: String, key2: String, keys: <repeated...>[String]): CompletionStage[Done]

    Remove all values from the cache

    Remove all values from the cache

    key1

    cache storage key

    key2

    cache storage key

    keys

    cache storage keys

    returns

    promise

  18. abstract def remove(arg0: String): CompletionStage[Done]
    Definition Classes
    AsyncCacheApi
  19. abstract def removeAll(): CompletionStage[Done]
    Definition Classes
    AsyncCacheApi
  20. abstract def removeAllKeys(keys: <repeated...>[String]): CompletionStage[Done]

    Removes all keys in arguments.

    Removes all keys in arguments. The other remove methods are for syntax sugar

    keys

    cache storage keys

    returns

    promise

  21. abstract def removeMatching(pattern: String): CompletionStage[Done]

    Removes all keys matching the given pattern.

    Removes all keys matching the given pattern. This command has no direct support in Redis, it is combination of KEYS and DEL commands.

    • KEYS pattern command finds all keys matching the given pattern
    • DEL keys expires all of them

    This is usable in scenarios when multiple keys contains same part of the key, such as record identification, user identification, etc. For example, we may have keys such as 'page/$id/header', 'page/$id/body', 'page/$id/footer' and we want to remove them all when the page is changed. We use the benefit of the naming convention we use and execute removeAllMatching( s"page/$id/*" ), which invalidates everything related to the given page. The benefit is we do not need to maintain the list of all keys to invalidate, we invalidate them all at once.

    Warning: complexity is O(n) where n are all keys in the database

    pattern

    this must be valid KEYS pattern

    returns

    nothing

  22. abstract def set[T](key: String, classTag: Class[T]): AsyncRedisSet[T]

    Scala wrapper around Redis set-related commands.

    Scala wrapper around Redis set-related commands. This simplifies use of the sets.

    key

    the key storing the set

    classTag

    class to be parsed from the redis

    returns

    Scala wrapper

  23. abstract def set(arg0: String, arg1: AnyRef): CompletionStage[Done]
    Definition Classes
    AsyncCacheApi
  24. abstract def set(arg0: String, arg1: AnyRef, arg2: Int): CompletionStage[Done]
    Definition Classes
    AsyncCacheApi
  25. abstract def setAll(keyValues: <repeated...>[KeyValue]): CompletionStage[Done]

    Sets the given keys to their respective values for eternity.

    Sets the given keys to their respective values for eternity. If any value is null, the particular key is excluded from the operation and removed from cache instead. The operation is atomic when there are no nulls. It replaces existing values.

    keyValues

    cache storage key-value pairs to store

    returns

    promise

  26. abstract def setAllIfNotExist(keyValues: <repeated...>[KeyValue]): CompletionStage[Boolean]

    Sets the given keys to their respective values for eternity.

    Sets the given keys to their respective values for eternity. It sets all values if none of them exist, if at least a single of them exists, it does not set any value, thus it is either all or none. If any value is null, the particular key is excluded from the operation and removed from cache instead. The operation is atomic when there are no nulls.

    keyValues

    cache storage key-value pairs to store

    returns

    true if value was set, false if any value already existed before

  27. abstract def setIfNotExists(key: String, value: AnyRef, expiration: Int): CompletionStage[Boolean]

    Set a value into the cache if the given key is not already used, otherwise do nothing.

    Set a value into the cache if the given key is not already used, otherwise do nothing. Expiration time in seconds (0 second means eternity).

    Note: When expiration is defined, it is not an atomic operation. Redis does not provide a command for store-if-not-exists with duration. First, it sets the value if exists. Then, if the operation succeeded, it sets its expiration date.

    Note: When recovery policy used, it recovers with TRUE to indicate **"the lock was acquired"** despite actually **not storing** anything.

    key

    cache storage key

    value

    value to store

    expiration

    record duration in seconds

    returns

    true if value was set, false if was ignored because it existed before

  28. abstract def setIfNotExists(key: String, value: AnyRef): CompletionStage[Boolean]

    Set a value into the cache if the given key is not already used, otherwise do nothing.

    Set a value into the cache if the given key is not already used, otherwise do nothing. Expiration time in seconds (0 second means eternity).

    Note: When expiration is defined, it is not an atomic operation. Redis does not provide a command for store-if-not-exists with duration. First, it sets the value if exists. Then, if the operation succeeded, it sets its expiration date.

    Note: When recovery policy used, it recovers with TRUE to indicate **"the lock was acquired"** despite actually **not storing** anything.

    key

    cache storage key

    value

    value to store

    returns

    true if value was set, false if was ignored because it existed before

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. def decrement(key: String): CompletionStage[Long]

    Decrements the stored string value representing 10-based signed integer by given value.

    Decrements the stored string value representing 10-based signed integer by given value. By default, the value is decremented by 1.

    key

    cache storage key

    returns

    the value after the decrement

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def getAll[T](classTag: Class[T], keys: <repeated...>[String]): CompletionStage[List[Optional[T]]]

    Retrieve the values of all specified keys from the cache.

    Retrieve the values of all specified keys from the cache.

    classTag

    class to be parsed from the redis

    keys

    cache storage keys

    returns

    stored record, Some if exists, otherwise None

  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def increment(key: String): CompletionStage[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. By default, the value is incremented by 1.

    key

    cache storage key

    returns

    the value after the increment

  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. def sync(): SyncCacheApi
    Definition Classes
    AsyncCacheApi
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. 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.

  2. def getOptional[T <: AnyRef](arg0: String): CompletionStage[Optional[T]]
    Definition Classes
    AsyncCacheApi
    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from cache.AsyncCacheApi

Inherited from AnyRef

Inherited from Any

Ungrouped