Class

play.api.cache.redis

RedisCache

Related Doc: package redis

Permalink

class RedisCache[Result[_]] extends InternalCacheApi[Result] with Implicits with Config with AkkaSerializer

Implementation of plain API using redis-server cache and Brando connector implementation.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RedisCache
  2. AkkaSerializer
  3. Config
  4. Implicits
  5. InternalCacheApi
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RedisCache()(implicit builder: ResultBuilder[Result], application: Application, lifecycle: ApplicationLifecycle, configuration: Configuration, system: ActorSystem)

    Permalink

Type Members

  1. implicit class RedisRef extends AnyRef

    Permalink

    rich akka actor providing additional functionality and syntax sugar

    rich akka actor providing additional functionality and syntax sugar

    Attributes
    protected
    Definition Classes
    Implicits
  2. implicit class RichFuture[T] extends AnyRef

    Permalink

    enriches any ref by toFuture converting a value to Future.successful

    enriches any ref by toFuture converting a value to Future.successful

    Attributes
    protected
    Definition Classes
    Implicits
  3. implicit class Synchronizer[T] extends AnyRef

    Permalink

    waits for future responses and returns them synchronously

    waits for future responses and returns them synchronously

    Attributes
    protected
    Definition Classes
    Implicits

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. implicit val application: Application

    Permalink

    current application

    current application

    Attributes
    protected
    Definition Classes
    RedisCacheAkkaSerializer
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. implicit def build[T, Result[_]](value: Future[T])(implicit builder: ResultBuilder[Result], configuration: Configuration): Result[T]

    Permalink

    Transforms the promise into desired builder results

    Transforms the promise into desired builder results

    Attributes
    protected
    Definition Classes
    Implicits
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. implicit val configuration: Configuration

    Permalink

    configuration of the connection

    configuration of the connection

    Attributes
    protected
    Definition Classes
    RedisCacheConfig
  9. implicit val context: ExecutionContext

    Permalink

    default invocation context of all cache commands

    default invocation context of all cache commands

    Attributes
    protected
  10. def database: Int

    Permalink

    redis database to work with

    redis database to work with

    Attributes
    protected
    Definition Classes
    Config
  11. def decode[T](key: String, value: String)(implicit classTag: ClassTag[T]): Try[T]

    Permalink

    decode given value and handle error if occurred

    decode given value and handle error if occurred

    Attributes
    protected
    Definition Classes
    AkkaSerializer
  12. def encode(key: String, value: Any): Try[String]

    Permalink

    encode given value and handle error if occurred

    encode given value and handle error if occurred

    Attributes
    protected
    Definition Classes
    AkkaSerializer
  13. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  15. 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

    Definition Classes
    RedisCacheInternalCacheApi
  16. 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

    Definition Classes
    RedisCacheInternalCacheApi
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. 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

    Definition Classes
    RedisCacheInternalCacheApi
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def getOrElse[T](key: String, expiration: Duration)(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

    Definition Classes
    RedisCacheInternalCacheApi
  21. def getOrFuture[T](key: String, expiration: Duration)(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

    Definition Classes
    RedisCacheInternalCacheApi
  22. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  23. def host: String

    Permalink

    host with redis server

    host with redis server

    Attributes
    protected
    Definition Classes
    Config
  24. def invalidate(): Result[Unit]

    Permalink

    Remove all keys in cache

    Remove all keys in cache

    returns

    promise

    Definition Classes
    RedisCacheInternalCacheApi
  25. val invocationContext: String

    Permalink

    default invocation context of all cache commands

    default invocation context of all cache commands

    Attributes
    protected
    Definition Classes
    Config
  26. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  27. val log: Logger

    Permalink

    logger instance

    logger instance

    Attributes
    protected
    Definition Classes
    RedisCacheAkkaSerializer
  28. 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

    Definition Classes
    RedisCacheInternalCacheApi
  29. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  32. def password: Option[String]

    Permalink

    password for authentication with redis

    password for authentication with redis

    Attributes
    protected
    Definition Classes
    Config
  33. def port: Int

    Permalink

    port redis listens on

    port redis listens on

    Attributes
    protected
    Definition Classes
    Config
  34. val redis: RedisRef

    Permalink

    communication module to Redis cache

    communication module to Redis cache

    Attributes
    protected
  35. 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

    Definition Classes
    RedisCacheInternalCacheApi
  36. 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

    Definition Classes
    RedisCacheInternalCacheApi
  37. 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

    Definition Classes
    RedisCacheInternalCacheApi
  38. 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

    Definition Classes
    RedisCacheInternalCacheApi
  39. def set(key: String, value: Any, expiration: Duration): 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

    Definition Classes
    RedisCacheInternalCacheApi
  40. def start(): Future[Unit]

    Permalink
  41. def stop(): Future[Unit]

    Permalink

    stops running brando actor

  42. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  43. implicit val system: ActorSystem

    Permalink
    Attributes
    protected
    Definition Classes
    RedisCacheAkkaSerializer
  44. implicit val timeout: Timeout

    Permalink

    timeout of cache requests

    timeout of cache requests

    Attributes
    protected
    Definition Classes
    Config
  45. def toString(): String

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

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

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

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

Inherited from AkkaSerializer

Inherited from Config

Inherited from Implicits

Inherited from InternalCacheApi[Result]

Inherited from AnyRef

Inherited from Any

Ungrouped