Skip to content
New issue

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

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

Already on GitHub? # to your account

[Feature Request] Set cacheLife per request? #394

Open
bendcarmen opened this issue Mar 27, 2024 · 0 comments
Open

[Feature Request] Set cacheLife per request? #394

bendcarmen opened this issue Mar 27, 2024 · 0 comments

Comments

@bendcarmen
Copy link

bendcarmen commented Mar 27, 2024

Hello and thank you for this wonderful library, I have a question/suggestion...is it possible to set different cacheLife values for different responseIds? If not would it make sense to do something like that?

useGet("url-1", {
cacheLife: 60000
});

useGet("url-2", {
cacheLife: 1000
});

I appreciate your time, I was not seeing the ability to do that currently...it seemed like cacheLife would be "overwritten" for "url-1", to 1000 but I might be totally misunderstanding what is happening?

Here is an example where I am using useGet in 2 instances...in one I am setting a cacheLife of 60000ms to fetch a Kanye quote, in the other I am fetching a fake name to attribute the quote to and am setting the cacheLife to 1000ms....and it seems that both are using the 1000ms cacheLife:

https://codesandbox.io/p/sandbox/crazy-resonance-2nv6yn?file=%2Fsrc%2FApp.js

I appreciate any help/guidance on this...thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant