Smarter Application Caching with Kotlin Flow
summary
Shows a concrete caching layer built with Kotlin Flow that emits cached data immediately and network data when it arrives, using a createCachedCacheFlow pattern backed by a Firestore GET as the source and Compose + ViewModel for state. Demo uses a Firestore backend with a simulated 7s network delay and a max data age 3s policy, demonstrating layered caches, OkHttp/cache-control tradeoffs, an error-filter policy that surfaces real errors (e.g. user not found), and a working offline UX with stale-data banners.
AI-written summary · about
chapters (10)
- 0:00Introduction and setup
- 1:52Why native apps over web
- 6:10Cache control headers explained
- 11:25Application layer caching
- 17:21Nick's caching layer concept
- 18:46Live demo of caching layer
- 23:00Handling errors and stale data
- 27:13Code walkthrough of caching layer
- 35:33Stale data indicator implementation
- 38:20Summary and call to action
related talks
17mFrom SQL to Flow: clean offline-first architecture with Kotlin 2.x
24mUsing Kotlin Flow in MVVM
29mKotlin State & Shared Flows in Action
34mHow to reactively load and cache data without even trying
19mCaching with Cache2K
42mVISUALIZING KOTLIN FLOW IN ANDROID
53mLeveraging Caching For Cloud Native Applications
36mCompose Your Mobile App With GraphQL
