question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] allow supplying a different cache key derivation function for urls

See original GitHub issue

i can understand why okhttp3.Cache is made final as mentioned in https://github.com/square/okhttp/issues/2740 , also mentioned in https://github.com/square/okhttp/issues/1459 , https://github.com/square/okhttp/issues/2261 , but i think a small change can be made to greatly increase flexibility, without changing it’s final status

that is, allow providing a different key implementation, currently it’s just a one-liner that converts a url to a string: https://github.com/square/okhttp/blob/fb284d35083e466c435565b9a1ee4092e322cc83/okhttp/src/main/java/okhttp3/Cache.java#L186 i believe adding a option to change it is easy, possibly using the builder pattern, and won’t require change to any other components

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
swankjessecommented, Mar 21, 2019

That is strange, how does it work with browsers where caches aren’t configurable?

The URL is a really awesome cache key, and URLs should be designed with caching in mind. You should use path & query for data that impacts caching (userId), and headers for things that don’t (signature).

If your server developers didn’t do this, they should! It’ll improve caching on every HTTP client.

0reactions
yschimkecommented, Mar 29, 2020

Won’t fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manipulating the cache key | Fastly Help Guides
You can set the cache key explicitly (including attaching conditions) by adding a request setting via the Settings page in the configuration ...
Read more >
Shedding Light on Samsung's TrustZone Keymaster Design
The Android application requests a new key to be gen- erated. The Keymaster TA generates a new key, and encrypts it using a...
Read more >
Chapter 5. Authentication and Interoperability Red Hat ...
New Kerberos credential cache type: KCM. This update adds a new SSSD service named kcm . The service is included in the sssd-kcm...
Read more >
DASH-IF implementation guidelines: content protection and ...
A DRM system cooperates with the device's media platform to enable playback of encrypted content while protecting the decrypted samples and ...
Read more >
Enable Enhanced Domains - Salesforce Help
To update your Salesforce org's URLs to the latest standards, enable and deploy enhanced domains. With enhanced domains, all URLs across your org...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found