CacheBasedLocalDataSource

A LocalDataSource backed by a kenwork Cache. Mirrors SwiftyNetwork's CacheBasedLocalDataSource.

Constructors

Link copied to clipboard
constructor(cache: Cache<E>)

Functions

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

A hot stream of CacheChanges for the underlying store, enabling reactive reads via Repository.stream. The default is an empty flow (non-reactive source).

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

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

Link copied to clipboard
open suspend override fun read(key: CacheKey): E?

Returns the entity stored for key, or null.

Link copied to clipboard
open suspend override fun remove(key: CacheKey)

Removes the entity stored for key.

Link copied to clipboard
open suspend override fun removeAll()

Removes all stored entities.

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

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

Link copied to clipboard
open suspend override fun write(entity: E, key: CacheKey)

Stores entity for key.