Cache

zio.query.Cache
See theCache companion object
trait Cache

A Cache maintains an internal state with a mapping from requests to Refs that will contain the result of those requests when they are executed. This is used internally by the library to provide deduplication and caching of requests.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Abstract methods

def get[E, A](request: Request[E, A])(implicit trace: Trace): IO[Unit, Ref[Option[Either[E, A]]]]

Looks up a request in the cache, failing with the unit value if the request is not in the cache, succeeding with Ref(None) if the request is in the cache but has not been executed yet, or Ref(Some(value)) if the request has been executed.

Looks up a request in the cache, failing with the unit value if the request is not in the cache, succeeding with Ref(None) if the request is in the cache but has not been executed yet, or Ref(Some(value)) if the request has been executed.

Attributes

def lookup[R, E, A, B](request: A)(implicit ev: A <:< Request[E, B], trace: Trace): UIO[Either[Ref[Option[Either[E, B]]], Ref[Option[Either[E, B]]]]]

Looks up a request in the cache. If the request is not in the cache returns a Left with a Ref that can be set with a Some to complete the request. If the request is in the cache returns a Right with a Ref that either contains Some with a result if the request has been executed or None if the request has not been executed yet.

Looks up a request in the cache. If the request is not in the cache returns a Left with a Ref that can be set with a Some to complete the request. If the request is in the cache returns a Right with a Ref that either contains Some with a result if the request has been executed or None if the request has not been executed yet.

Attributes

def put[E, A](request: Request[E, A], result: Ref[Option[Either[E, A]]])(implicit trace: Trace): UIO[Unit]

Inserts a request and a Ref that will contain the result of the request when it is executed into the cache.

Inserts a request and a Ref that will contain the result of the request when it is executed into the cache.

Attributes

def remove[E, A](request: Request[E, A])(implicit trace: Trace): UIO[Unit]

Removes a request from the cache.

Removes a request from the cache.

Attributes