EhCacheApi

play.api.cache.ehcache.EhCacheApi
class EhCacheApi(val cache: Ehcache)(implicit context: ExecutionContext) extends AsyncCacheApi

Ehcache implementation of AsyncCacheApi. Since Ehcache is synchronous by default, this uses SyncEhCacheApi.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def get[T : ClassTag](key: String): Future[Option[T]]

Retrieve a value from the cache for the given type

Retrieve a value from the cache for the given type

Value parameters

key

Item key.

Attributes

Returns

result as a future of Option[T]

def getOrElseUpdate[A : ClassTag](key: String, expiration: Duration)(orElse: => Future[A]): Future[A]

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

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

Value parameters

expiration

expiration period in seconds.

key

Item key.

orElse

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

Attributes

def remove(key: String): Future[Done]

Remove a value from the cache

Remove a value from the cache

Attributes

Removes all values from the cache. This may be useful as an admin user operation if it is supported by your cache.

Removes all values from the cache. This may be useful as an admin user operation if it is supported by your cache.

Attributes

Returns

a Future[Done], which is completed with either a Done or an exception if the clear did not work.

Throws
UnsupportedOperationException

if this cache implementation does not support removing all values.

def set(key: String, value: Any, expiration: Duration): Future[Done]

Set a value into the cache.

Set a value into the cache.

Value parameters

expiration

Expiration time.

key

Item key.

value

Item value.

Attributes

Concrete fields

lazy override val sync: SyncEhCacheApi

Get an instance of SyncCacheApi to make synchronous calls.

Get an instance of SyncCacheApi to make synchronous calls.

Attributes