RetrostashOkHttpInterceptor
OkHttp Interceptor that powers @CacheQuery / @CacheMutate semantics.
Reads metadata from the request via either:
An OkHttpRetrostashMetadata tag attached by retrostash, retrostashQuery, or retrostashMutate.
A Retrofit
Invocationtag — auto-extracted via RetrofitMetadataExtractor.
On a query: short-circuits to a synthetic Response built from the cached payload when the key resolves and the entry is fresh.
On a mutation: forwards the call to the network, then on 2xx resolves OkHttpRetrostashMetadata.invalidateTemplates against bindings and invalidates each.
Mutation responses are tagged with Cache-Control: no-store so OkHttp's own HTTP cache (if one is configured on the client) does not retain mutation payloads. GET responses are passed through unchanged — Retrostash does not modify GET Cache-Control headers; that's between the origin and OkHttp's HTTP cache.
The synthetic cache-hit response carries a custom X-Retrostash-Source header so callers can distinguish hit/miss without inspecting the cache directly. Possible values:
retrostash-cache— served from Retrostash's store.okhttp-cache— served from OkHttp's HTTP cache (Retrostash store missed). Retrostash invalidation does not reach OkHttp HTTP cache; see Caching strategy.okhttp-validated-cache— OkHttp HTTP cache hit revalidated with the network.network— fresh network response.