Disabled

The cache that stores nothing and shares nothing: every call runs its own loader on the caller's coroutine.

Stable Core. It forfeits "N concurrent callers cost one load". Final, stateless and shared; usable without the opt-in. stats is always CacheStats.Empty, invalidate and invalidateAll do nothing, and close does nothing, so a client may close it safely. toString() is ResponseCache.Disabled.

Functions

Link copied to clipboard
open override fun close()

Releases the cache's resources. Idempotent, non-suspending, does not throw. The default does nothing.

Link copied to clipboard
open suspend fun <V : Any> getOrLoad(key: CacheKey<V>, policy: CachePolicy, loader: suspend () -> Result<Lookup<V>>): Result<Lookup<V>>

getOrLoad accepting any live entry (maxAge is Duration.INFINITE).

open suspend override fun <V : Any> getOrLoad(key: CacheKey<V>, policy: CachePolicy, maxAge: Duration, loader: suspend () -> Result<Lookup<V>>): Result<Lookup<V>>

Returns the stored answer for key if one is live and no older than maxAge; otherwise joins the load in flight for key, or starts one with loader.

Link copied to clipboard
open override fun invalidate(key: CacheKey<*>)

Drops key's stored or in-flight entry (contract point 7): the next call for key loads anew, and a load in flight still completes for the calls already waiting without being stored. Never throws; a no-op after close.

Link copied to clipboard
open override fun invalidateAll()

Drops every stored or in-flight entry (contract point 7), as invalidate does for one key. Never throws; a no-op after close.

Link copied to clipboard
open override fun stats(): CacheStats

Reads the four counts (contract point 8).

Link copied to clipboard
open override fun toString(): String

Returns the fixed text ResponseCache.Disabled, for diagnostics and logs.