Trait

play.api.cache.redis

InternalCacheApi

Related Doc: package redis

Permalink

trait InternalCacheApi[Result[_]] extends AnyRef

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. Furthermore, due to its parametrization it allows to decide whether it produces blocking results or non-blocking promises.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. InternalCacheApi
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Abstract Value Members

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

  2. abstract def expire(key: String, expiration: Duration): Result[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

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

  4. abstract def getOrElse[T](key: String, expiration: Duration = Duration.Inf)(orElse: ⇒ T)(implicit arg0: ClassTag[T]): Result[T]

    Permalink

    Retrieve a value from the cache.

    Retrieve a value from the cache. If is missing, set default value with given expiration and return the value.

    key

    cache storage key

    expiration

    expiration period in seconds.

    orElse

    The default function to invoke if the value was not found in cache.

    returns

    stored or default record, Some if exists, otherwise None

  5. abstract def getOrFuture[T](key: String, expiration: Duration = Duration.Inf)(orElse: ⇒ Future[T])(implicit arg0: ClassTag[T]): Future[T]

    Permalink

    Retrieve a value from the cache.

    Retrieve a value from the cache. If is missing, set default value with given expiration and return the value.

    key

    cache storage key

    expiration

    expiration period in seconds.

    orElse

    The default function to invoke if the value was not found in cache.

    returns

    stored or default record, Some if exists, otherwise None

  6. abstract def invalidate(): Result[Unit]

    Permalink

    Remove all keys in cache

    Remove all keys in cache

    returns

    promise

  7. abstract def matching(pattern: String): Result[Set[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

  8. abstract def remove(key1: String, key2: String, keys: String*): Result[Unit]

    Permalink

    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

  9. abstract def remove(key: String): Result[Unit]

    Permalink

    Remove a value under the given key from the cache

    Remove a value under the given key from the cache

    key

    cache storage key

    returns

    promise

  10. abstract def removeAll(keys: String*): Result[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

  11. abstract def removeMatching(pattern: String): Result[Unit]

    Permalink

    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

  12. abstract def set(key: String, value: Any, expiration: Duration = Duration.Inf): Result[Unit]

    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

    returns

    promise

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 AnyRef

Inherited from Any

Ungrouped