RetrostashOkHttpConfig

data class RetrostashOkHttpConfig(val timeoutMs: Long = 250, val maxEntries: Int = 64, val maxBytes: Long = 2 * 1024 * 1024L, val defaultMaxAgeMs: Long = 10 * 60 * 1000L, val logger: (String) -> Unit? = null, val cacheDirName: String = "retrostash_okhttp_cache", val prefsName: String = "retrostash_okhttp_store")

Tunables for RetrostashOkHttpInterceptor and AndroidRetrostashStore.

Caching strategy

Retrostash maintains its own annotation-driven cache (the dev.logickoder.retrostash.core.RetrostashStore). Treat it as the only Retrostash-controlled cache layer. If you also pass cache(...) to your OkHttpClient.Builder, OkHttp's HTTP disk cache obeys origin Cache-Control headers independently — Retrostash invalidation does not evict OkHttp HTTP cache entries.

Most apps want exactly one cache layer. Drop cache(...) from your OkHttpClient.Builder and let Retrostash own the lifecycle. See Caching strategy.

Constructors

Link copied to clipboard
constructor(timeoutMs: Long = 250, maxEntries: Int = 64, maxBytes: Long = 2 * 1024 * 1024L, defaultMaxAgeMs: Long = 10 * 60 * 1000L, logger: (String) -> Unit? = null, cacheDirName: String = "retrostash_okhttp_cache", prefsName: String = "retrostash_okhttp_store")

Properties

Link copied to clipboard

Subdirectory of Context.cacheDir used by AndroidRetrostashStore.

Link copied to clipboard

TTL for Retrostash's own store entries when a @CacheQuery does not declare one. Applies to every cached payload (GET and POST queries).

Link copied to clipboard
val logger: (String) -> Unit?

Optional event hook for cache hits / misses / evictions.

Link copied to clipboard

Soft cap on total persisted bytes (LRU eviction beyond this).

Link copied to clipboard

Soft cap on entries held by the disk store (LRU eviction beyond this).

Link copied to clipboard

SharedPreferences name used by AndroidRetrostashStore for index storage.

Link copied to clipboard

Per-store-call deadline. Slow store I/O falls through to the network.