Package-level declarations

Types

Link copied to clipboard
class AnyCache<V : Any>(wrapped: Cache<V>) : Cache<V>

A type-forwarding wrapper around an arbitrary Cache.

Link copied to clipboard
interface Cache<V : Any>

An asynchronous key-value cache.

Link copied to clipboard
sealed interface CacheChange

A mutation observed on a Cache, emitted by Cache.changes.

Link copied to clipboard
data class CacheEntry<V : Any>(val value: V, val timestamp: Long)

A cached value together with the epoch-millisecond timestamp it was stored at.

Link copied to clipboard
data class CacheKey(val rawValue: String)

A stable, hashable identifier for a cached value.

Link copied to clipboard
sealed interface CachePolicy

Strategy describing how a repository should reconcile cached data with the network. Mirrors SwiftyNetwork's CachePolicy.

Link copied to clipboard
class FileSystemCache<V : Any>(directory: File, encode: (V) -> String, decode: (String) -> V, ioContext: CoroutineContext = Dispatchers.IO, currentTimeMillis: () -> Long = System::currentTimeMillis) : TimestampedCache<V> , PersistentCache<V>

A durable PersistentCache that stores each entry as a file under directory.

Link copied to clipboard
class InMemoryCache<V : Any>(maxSize: Int? = null, currentTimeMillis: () -> Long = System::currentTimeMillis) : TimestampedCache<V>

An in-memory TimestampedCache with optional LRU eviction.

Link copied to clipboard
class LayeredCache<V : Any>(memory: Cache<V>, persistent: Cache<V>? = null) : Cache<V>

A two-tier cache composing a fast memory layer over an optional persistent layer.

Link copied to clipboard
interface PersistentCache<V : Any> : Cache<V>

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

Link copied to clipboard
interface TimestampedCache<V : Any> : Cache<V>

A Cache that lets callers supply an explicit timestamp when writing, so values promoted between cache layers can keep their original age. Mirrors SwiftyNetwork's TimestampedCache.

Functions

Link copied to clipboard

Whether cached data of age cacheAgeMillis may be served under this policy.