Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Paging] Persist first page of cache if a refresh needs to happen #67

Open
levibostian opened this issue May 4, 2020 · 0 comments
Open

Comments

@levibostian
Copy link
Owner

With paging support, we are handling refresh calls when the user wants to force a refresh.

But, what if it's not a force refresh but just a periodic refresh from too old of cache? We should only be persisting the first page of data at that point, too.

Proposal:

Change to...

# In Repository
protected fun needsARefresh(requirements): Bool {
  return !syncStateManager.hasEverFetchedData(tag: requirements.tag) || syncStateManager.isCacheTooOld(tag: requirements.tag, maxAgeOfCache: dataSource.maxAgeOfCache)
}

# In paging repository
if (force || super.needsARefresh(requirements)) {
  ...persist only first page...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant