-
Notifications
You must be signed in to change notification settings - Fork 150
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
Feature: optional refresh strategy (stale-while-revalidate) #533
Comments
I think, Or maybe I'm wrong but the Can you explain to me the difference between using refreshThreshold and using a smaller ttl? |
the refresh threshold allows for a new functionality. Essentialy you can reach a 100% cache coverage without complicated cron jobs. |
With this we only get necessary calls to our database, since we don't know if this value is going to be used or it is going to be invalidated but we have to make the call at that time yes or yes. Can you describe a situation where it is used, because this requires more logic in the set method. If I did another method with this functionality, would it work for you? |
I wouldn't put the logic into the set function. That logic is useful if the data isn't critical but called really often. Here is the PR of the old logic, that got removed with 5.0.0: #138 |
one use case? |
It's still not in the set function. A use case: we cash the result of a function with wrap that takes upwards of 10 seconds but the wrap function gets called a hundred times per second. I'm not talking about a must have feature, but a pretty useful option. |
Do the PR. But if a function takes 10 seconds it doesn't have to be in a REST API, it should be under messaging in another microservice. |
Who says the request is not handled by a message queue in another Microservice? I will look into the code after my vacation. |
If the function has a time of 10 seconds, if it is a query, it would have to be reconsidered, if it is a computing function or something like that, you have to put a messaging system through queues, redis, rabbitmq, or your broker made with ntex and mttq. In the front, an SSE should be enough to receive the answer. Or I work with mttq over websocket if they are constant calls. I have a lot of experience with realtime at low level and high scalability. My main tools are postgres and redis, node for rapid prototyping microservices, python for ai and rust for what they leave me, because nobody knows Rust anywhere, it's a trauma. Happy holidays, if you can, don't come to Barcelona because there are already a lot of people and we don't fit. Thank you! |
https://www.reactivemanifesto.org/ I think it has to do with responsive |
here the pull request: #586 |
update: README.md
update: README.md
update: tests to be less time sensitive in slow environments
* feat: optional refresh strategy (stale-while-revalidate) #533 * feat: optional refresh strategy (stale-while-revalidate) #533 test update * feat: optional refresh strategy (stale-while-revalidate) #533 update: README.md * feat: optional refresh strategy (stale-while-revalidate) #533 update: README.md * feat: optional refresh strategy (stale-while-revalidate) #533 update: tests to be less time sensitive in slow environments
Before version 5 there was the option for a "refreshThreshold" for the any store.
The ttl of the cached key was checked against the refreshThreshold.
If the ttl was less than the refreshThreshold, the value was returned immediately, the provided function was still triggered to refresh the cache.
The benefit would be a more conservative caching strategy.
The text was updated successfully, but these errors were encountered: