Design a Caching Strategy
3 fill-in slots · from The AI Prompt Handbook for Mobile App Development
Your details
0/3 filledDesign a Caching Strategy
Background: Native [platform] app. This data is expensive or slow to fetch: [describe—e.g., feed, images, reference data]. How fresh it needs to be: [real-time / minutes / hours / rarely changes]. Use case: Design a caching strategy that makes the app feel instant without serving dangerously stale data. Implementation details: - Layered cache: in-memory (fast, volatile) over on-disk (survives relaunch); decide what belongs in each - A freshness policy: TTL, ETag/Last-Modified conditional requests, or cache-then-revalidate (stale-while-revalidate) - Invalidation: how and when entries are evicted or refreshed, including on user-driven actions (pull to refresh, logout clears user data) - iOS: where URLCache, NSCache, and on-disk store each fit. Android: OkHttp cache, in-memory cache, and DataStore/Room for structured data. - Image caching specifically, if relevant (sizes, memory pressure) Layer & dependencies: Caching is a data-layer concern hidden behind the repository; callers just ask for data. Deliverable: A caching design with the layers, the freshness/ invalidation policy per data type, the eviction rules, and the memory-pressure handling.
Highlighted [slots] are still empty. Downloads are plain .txt — paste into any AI assistant.