PersistentCache

interface PersistentCache<V : Any> : Cache<V>

Marker interface for caches backed by durable storage (disk, database). Mirrors SwiftyNetwork's PersistentCache.

Inheritors

Functions

Link copied to clipboard
open fun changes(): Flow<CacheChange>

A hot stream of CacheChanges for this cache. The default is an empty flow, so caches that cannot observe mutations are simply non-reactive; observable caches override this.

Link copied to clipboard
open suspend fun entry(key: CacheKey): CacheEntry<V>?

Atomically returns the value and its timestamp for key, or null if absent.

Link copied to clipboard
abstract suspend fun removeAll()

Removes every entry.

Link copied to clipboard
abstract suspend fun removeValue(key: CacheKey)

Removes any value stored for key.

Link copied to clipboard
abstract suspend fun setValue(value: V, key: CacheKey)

Stores value for key, stamping it with the current time.

Link copied to clipboard
abstract suspend fun timestamp(key: CacheKey): Long?

Returns the epoch-millisecond timestamp recorded for key, or null if absent.

Link copied to clipboard
abstract suspend fun value(key: CacheKey): V?

Returns the value stored for key, or null if absent.