← ZIO Cache docs

ScopedCache

zio.cache.ScopedCache
See theScopedCache companion object
abstract class ScopedCache[-Key, +Error, +Value]

Attributes

Companion
object
Source
ScopedCache.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

Returns statistics for this cache.

Returns statistics for this cache.

Attributes

Source
ScopedCache.scala
def contains(key: Key): UIO[Boolean]

Return whether a resource associated with the specified key exists in the cache. Sometime contains can return true if the resource is currently being created but not yet totally created

Return whether a resource associated with the specified key exists in the cache. Sometime contains can return true if the resource is currently being created but not yet totally created

Attributes

Source
ScopedCache.scala
def entryStats(key: Key): UIO[Option[EntryStats]]

Return statistics for the specified entry.

Return statistics for the specified entry.

Attributes

Source
ScopedCache.scala
def get(key: Key): ZIO[Scope, Error, Value]

Gets the value from the cache if it exists or otherwise computes it, the release action signals to the cache that the value is no longer being used and can potentially be finalized subject to the policies of the cache

Gets the value from the cache if it exists or otherwise computes it, the release action signals to the cache that the value is no longer being used and can potentially be finalized subject to the policies of the cache

Attributes

Source
ScopedCache.scala
def invalidate(key: Key): UIO[Unit]

Invalidates the resource associated with the specified key.

Invalidates the resource associated with the specified key.

Attributes

Source
ScopedCache.scala

Invalidates all values in the cache.

Invalidates all values in the cache.

Attributes

Source
ScopedCache.scala
def refresh(key: Key): IO[Error, Unit]

Force the reuse of the lookup function to compute the returned scoped effect associated with the specified key immediately Once the new resource is recomputed, the old resource associated to the key is cleaned (once all fiber using it are done with it) During the time the new resource is computed, concurrent call the .get will use the old resource if this one is not expired

Force the reuse of the lookup function to compute the returned scoped effect associated with the specified key immediately Once the new resource is recomputed, the old resource associated to the key is cleaned (once all fiber using it are done with it) During the time the new resource is computed, concurrent call the .get will use the old resource if this one is not expired

Attributes

Source
ScopedCache.scala
def size: UIO[Int]

Returns the approximate number of values in the cache.

Returns the approximate number of values in the cache.

Attributes

Source
ScopedCache.scala