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

Cache achievements for next use #2995

Open
maskaravivek opened this issue Jun 5, 2019 · 2 comments
Open

Cache achievements for next use #2995

maskaravivek opened this issue Jun 5, 2019 · 2 comments

Comments

@maskaravivek
Copy link
Member

Summary:

Our API to fetch feedback, uploads and nearby edits takes a significant amount of times and often it times out. It might be worthwhile to cache the results and display the cached data first. We can call the API asynchronously and update the view once the calls succeed.

As these results don't change very often, it shouldn't affect user experience.

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Jun 6, 2019

Ideally, the app try to could count what has changed since the cache was taken.
Example:

  1. User opens the achievements activity, a request is made and it returns upoads:60 wikidata:20
  2. The user uploads 3 pictures, including 1 using Nearby. The numbers are kept as a "delta".
  3. Eager to see their progress, the user opens the achievements activity again
  4. The cache is still valid (for instance it has been less than 3 hours since last time), so use the cache, but add the delta, resulting in upoads:63 wikidata:21

This technique does not account for deleted pictures, but the user will not realize that until the next cache invalidation.

@maskaravivek
Copy link
Member Author

The numbers are kept as a "delta".

IMO, this approach can be used for statistics that are specific to the android app but for other statistics, it might cause confusion. For eg. if the user uploads a few pictures using the app and a few others using some other platform. Then the number would not match either with what he last saw or with his actual upload count.

Instead, what about showing a small text:

Last updated at: 12th May 4 PM

This would be easier to develop and would also not cause any discrepancy. Along with a text, we can a small refreshing icon to indicate that we are fetching the results again. The idea is to not show a blank screen ever.

This technique does not account for deleted pictures, but the user will not realize that until the next cache invalidation.

I was thinking that it might not be very helpful to invalidate the cache at all. Anyways every time the user opens this page, we make the API call async and update our cache (irrespective of the fact that he waits on the screen or not). Given this flow, do we really need to invalidate cache. With "last updated at" and refreshing icon text, the user will understand that the results are outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants