HTTPClient Cache Reuse Without Server Freshness Check in Background Fetch
0 reputation · 08 May 2024, 23:14 UTC
The HTTPClient cache in Appcelerator Titanium stores responses keyed by URL and ETag, but does not automatically invalidate on server-side changes unless the request includes Cache-Control headers. On Android 10+, the default max-stale value of 0 disables tolerance for expired entries, triggering immediate freshness checks, yet the interaction between this behavior and background fetch reissues is undocumented. When a background fetch cycle reissues a previously cached request, the framework may reuse the prior response without re-evaluating server freshness, potentially delivering stale data to the user. This behavior varies across TiSDK versions, as earlier releases lack the clearCache API and exhibit different cache eviction policies under memory pressure. The precise conditions under which cached responses are retained versus re-fetched during background fetch remain unresolved, creating uncertainty for applications that require up-to-date data in offline-first scenarios.
- Under what TiSDK and platform version combination does HTTPClient reuse a cached response during background fetch without re-evaluating the server ETag?
- Does the presence or absence of Cache-Control headers in the original request override the default max-stale=0 freshness check on Android 10+?
- How does memory-pressure-induced cache eviction on Android affect the likelihood of stale response reuse in subsequent background fetch cycles?