package cache
- Alphabetic
- Public
- All
Type Members
-
abstract
class
Cache[-Key, +Error, +Value] extends AnyRef
A
Cacheis defined in terms of a lookup function that, given a key of typeKey, can either fail with an error of typeErroror succeed with a value of typeValue.A
Cacheis defined in terms of a lookup function that, given a key of typeKey, can either fail with an error of typeErroror succeed with a value of typeValue. Getting a value from the cache will either return the previous result of the lookup function if it is available or else compute a new result with the lookup function, put it in the cache, and return it.A cache also has a specified capacity and time to live. When the cache is at capacity the least recently accessed values in the cache will be removed to make room for new values. Getting a value with a life older than the specified time to live will result in a new value being computed with the lookup function and returned when available.
The cache is safe for concurrent access. If multiple fibers attempt to get the same key the lookup function will only be computed once and the result will be returned to all fibers.
-
final
case class
CacheStats(hits: Long, misses: Long, size: Int) extends Product with Serializable
CacheStatsrepresents a snapshot of statistics for the cache as of a point in time. -
final
case class
EntryStats(loaded: Instant) extends Product with Serializable
EntryStatsrepresents a snapshot of statistics for an entry in the cache. -
final
case class
Lookup[-Key, -Environment, +Error, +Value](lookup: (Key) ⇒ ZIO[Environment, Error, Value]) extends (Key) ⇒ ZIO[Environment, Error, Value] with Product with Serializable
A
Lookuprepresents a lookup function that, given a key of typeKey, can return aZIOeffect that will either produce a value of typeValueor fail with an error of typeErrorusing an environment of typeEnvironment.A
Lookuprepresents a lookup function that, given a key of typeKey, can return aZIOeffect that will either produce a value of typeValueor fail with an error of typeErrorusing an environment of typeEnvironment.You can think of a
Lookupas an effectual function that computes a value given a key. Given any effectual function you can convert it to a lookup function for a cache by using theLookupconstructor. - abstract class ScopedCache[-Key, +Error, +Value] extends AnyRef
-
final
case class
ScopedLookup[-Key, -Environment, +Error, +Value](lookup: (Key) ⇒ ZIO[Environment with Scope, Error, Value]) extends (Key) ⇒ ZIO[Environment with Scope, Error, Value] with Product with Serializable
Like lookup but scoped version
Value Members
- object Cache
- object ScopedCache
- object ScopedCacheImplementation