-
-
Notifications
You must be signed in to change notification settings - Fork 203
Implement smarter caching strategy #659
Comments
If needed, I'll be also able to help with this one, after some quick consultation with @wellingguzman. |
There's another side to this though, if you're updating items at a very high rate, you might not want to invalidate the cache every time. I think there should be a function that can be called to invalidate the cache that you then can call from a hook. That way, the user is in full control of when the cache gets refreshed. |
I agree, but cannot come up with any use case which would require updating items at very high rate. Do you have any example? |
Your IoT device is pushing the sensor value every minute, you have a web app to visualize the last hour of values |
Thanks for the example. |
Also, I think directus_* collections shouldn't be cached. When changing the permissions it should propagate immediately |
I wouldn't even mind caching the user created collections only. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Can anyone take a look at this? Or can we discuss how can we implement this feature? Without the invalidation, the cache is unusable right now. But all of us could definitely benefit from the redis (or other cache) integration. I'm personally willing to work on this, just need some discussion on how to do it exactly. |
I think having one |
I love this Idea! 🙂😊 |
@honzabilek4 Does this PR helps to solve your current requirement? #892 |
Thanks! It seems like #892 could solve the issue. I'm going to test it in the following days and close the issue if applicable. |
Hey @honzabilek4 — any updates? :) |
Just curious the /me route, which displays info about currently logged in user gets cached, and it shouldn't because it depends on the auth token. Thoughts on this? Should I open a separate issue? |
^^^ Reminds me of #1476, so maybe we can continue that conversation there... |
Currently, when caching is enabled for the api, it considerably speeds up the response times. For example, it takes only around 15-20ms for us, which is awesome.
However, the whole feature becomes unusable, because all item listings are cached for the amount of TTL. This means that you cannot see any newly created items until the TTL expires.
The usual approach to solve this problem is invalidating the cache entries when an item is being added, deleted or updated. This is would be also the easiest, because new listings will be added back to cache while being read.
I think that this feature might be important to be able to scale the entire API instance and to lower some server workload.
The text was updated successfully, but these errors were encountered: