RetrostashOkHttpBridge
class RetrostashOkHttpBridge(val store: RetrostashStore, config: RetrostashOkHttpConfig = RetrostashOkHttpConfig(), keyResolver: CoreKeyResolver = CoreKeyResolver(), val engine: RetrostashEngine = RetrostashEngine(
store = store,
keyResolver = keyResolver,
timeoutMs = config.timeoutMs,
))
Top-level OkHttp/Retrofit integration object. Holds the RetrostashEngine + store and installs the two interceptors needed to read/write the cache:
RetrostashOkHttpHandleInterceptor(application interceptor) — exposes the bridge so callers can recover it via from.RetrostashOkHttpInterceptor (network interceptor) — actual cache logic.
For Android, prefer the convenience factory RetrostashOkHttpAndroid.install(builder, context) which constructs a Context-backed disk store automatically.
Pure-JVM consumers construct the bridge directly with their own RetrostashStore:
val bridge = RetrostashOkHttpBridge(
store = InMemoryRetrostashStore(),
config = RetrostashOkHttpConfig(logger = ::println),
)
val client = OkHttpClient.Builder().also(bridge::install).build()Content copied to clipboard
Direct cache control — peek, update, invalidate, clear — lives on cache. See RetrostashOkHttpCache and the README's Cache API section.
Constructors
Link copied to clipboard
constructor(store: RetrostashStore, config: RetrostashOkHttpConfig = RetrostashOkHttpConfig(), keyResolver: CoreKeyResolver = CoreKeyResolver(), engine: RetrostashEngine = RetrostashEngine(
store = store,
keyResolver = keyResolver,
timeoutMs = config.timeoutMs,
))