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

use okhttp client for caching (instead of glide) #1281

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

David-Development
Copy link
Member

This MR disables Glides Caching and uses OkHttp's caching instead. The reason is that Glide does not care about ETags and Last-Modified Headers. Once a URL is in the cache it stays there. See: bumptech/glide#1847

Fixes #1247

Changes:

  • Glide cache is now only 10mb as it is supposed to be used only for favicons
  • Default DiskCacheStrategy is now NONE - only favicons override this setting
  • OkHttp has a Cache now (which has the size of what's configured in the app settings - by default 500mb)

TODO:

  • Offline caching of images does not currently work (see todo in code)
  • Injecting images into articles from cache currently does not work (as the cache check only checks the glide cache - not the okhttp cache)

@David-Development
Copy link
Member Author

@tobiasKaminsky FYI - I saw that you were involved in the dicussion in bumptech/glide#1847. I think by using the OkHttp Client we can get around the issues with ETags / Last-Modfied without having to initiate a separate http request. But then again... this requires OkHttp which you are not using in the files app yet, eh?

@David-Development David-Development marked this pull request as draft September 30, 2023 15:16
@tobiasKaminsky
Copy link
Member

Nice idea!
On Files we slowly switch to okhttp3, so this can then be a way to go.

} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
body = URLEncoder.encode(debugInfo, StandardCharsets.UTF_8);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to stay as is see #1315

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

Successfully merging this pull request may close these issues.

sidebar nav avatar is not updating
3 participants