Skip to main content Link Search Menu Expand Document (external link)

PersistedCache overview

Added in v1.0.0


Table of contents


constructors

make

Signature

export declare const make: <K extends Persistence.ResultPersistence.KeyAny, R>(options: {
  readonly storeId: string
  readonly lookup: (key: K) => Effect.Effect<Schema.WithResult.Success<K>, Schema.WithResult.Failure<K>, R>
  readonly timeToLive: (...args: Persistence.ResultPersistence.TimeToLiveArgs<K>) => Duration.DurationInput
  readonly inMemoryCapacity?: number | undefined
  readonly inMemoryTTL?: Duration.DurationInput | undefined
}) => Effect.Effect<
  PersistedCache<K>,
  never,
  Schema.SerializableWithResult.Context<K> | R | Persistence.ResultPersistence | Scope.Scope
>

Added in v1.0.0

models

PersistedCache (interface)

Signature

export interface PersistedCache<K extends Persistence.ResultPersistence.KeyAny> {
  readonly get: (
    key: K
  ) => Effect.Effect<Schema.WithResult.Success<K>, Schema.WithResult.Failure<K> | Persistence.PersistenceError>
  readonly invalidate: (key: K) => Effect.Effect<void, Persistence.PersistenceError>
}

Added in v1.0.0