Instant feed rendering via two-level cache and lazy hero banner - #3142
Open
cloudflix-x wants to merge 5 commits into
Open
Instant feed rendering via two-level cache and lazy hero banner#3142cloudflix-x wants to merge 5 commits into
cloudflix-x wants to merge 5 commits into
Conversation
cloudflix-x
force-pushed
the
feat/home-provider-cache
branch
from
August 27, 2026 07:41
d6b3f66 to
ef98bba
Compare
fire-light42
requested changes
Aug 27, 2026
Collaborator
There was a problem hiding this comment.
Good idea, and great performance testing but this pull request is way too bloated, with cache logic interspersed with normal code. Surely you can move the cache logic to APIRepository to reduce the complexity and boilerplate by a lot.
This whole pull request (excluding tests) ought to be achievable in ~200 lines, not 700.
Author
|
@fire-light42 My bad for the messy diff before — had some messy merge/cherry-pick conflicts from my dev branch that pulled in unrelated stuff. It's clean and minimal now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implemented an intelligent Two-Level Provider & Homepage Cache Architecture (In-Memory
ConcurrentHashMap+ Persistent DiskSharedPreferencesJSON serialization) combined with Lazy Hero Banner Loading to accelerate home screen rendering, eliminate cold-start blank screens, and allow movie lists to populate instantly via a Stale-While-Revalidate pattern.Code Changes & Architecture
1. Two-Level Caching Engine (
HomeCache.kt)ConcurrentHashMapfor sub-millisecond retrieval of active feeds during session navigation.CachedHomeData,CachedHomePageResponse, andCachedSearchResponsesupporting serialization across allTvTypes (Movie,TvSeries,Anime,Live,Torrent).2. ViewModel & Lazy Hero Banner Integration (
HomeViewModel.kt)load()to immediately dispatch cached data viaHomeCache.getHomeCache(api.name), rendering movie lists directly from local disk cache.addJob = ioSafe { ... }), preventing network calls from blocking initial feed appearance.getMainPage()success without causing UI flicker or focus resets.3. API Load Response Caching (
APIRepository.kt)cacheTimeSeconds) and enabled/disabled state.4. User Preferences & Storage Management (
SettingsProviders.kt&DataStoreHelper.kt)DataStoreHelper.cacheTimeMinutes.formatShortFileSize).5. Automated Unit Tests (
HomeCacheTest.kt)Performance Impact (Xiaomi TV - Real Data)
master)feat/home-provider-cache)Validation
./gradlew testPrereleaseDebugUnitTest(AllHomeCacheTestcases passed)MiTV-MZTU0/ Android TV 14) via ADB instrumentationAI Disclosure
Screenshots
Provider Cache Settings & Duration Selector