CaffeineCacheApi

play.api.cache.caffeine.CaffeineCacheApi
class CaffeineCacheApi(val cache: NamedCaffeineCache[Any, Any]) extends AsyncCacheApi

Cache implementation of AsyncCacheApi

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

val cache: NamedCaffeineCache[Any, Any]
lazy override val sync: SyncCaffeineCacheApi

Get an instance of SyncCacheApi to make synchronous calls.

Get an instance of SyncCacheApi to make synchronous calls.

Attributes