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
Caching seems not to work at all #11378
Comments
Can confirm that on GET requests, the cache is not read; instead the database values are shown. Tested it by changing a value of the field of an item in the database itself (not via API/app) and got the "correct" values from the database even though the cache still holds a representation of this item (with a valid/not expired expiration date). Would have expected to rightfully get the cached version of the item here. EDIT: Directus 9.4.3 with PostgreSQL 10.14 |
@schlensen Please try to remove |
I am experiencing the same issue. Redis run on the Kubernetes alongside Directus, irregardless of |
We will have to take a closer look. Thank you! NotesWhen accessing from the admin portal at |
@licitdev |
@licitdev It's really strange - I can't reproduce the behaviour anymore. If I request items now the entries I see in the redis-logs only are:
I cannot explain why, I did not change the directus-version nor the auto-purge-flag or anything else. We had a massive delete-operation on this system (about 30.000 items at once) several days ago and due to this directus got stuck and crashed. Maybe this operation "confused" the cache and database. For now I'd say everything is fine again. I'll report if we can reproduce the problem in the future. Thanks for the great support here and keep it up! Jan |
@CoenWarmer |
Closing this in accordance with OP's update, and we'll reopen this when it the problem does occur again in the future. Plus the different issue reported in this thread has been tracked in a separate issue. |
Preflight Checklist
Describe the Bug
Digging very deep into directus, the database and especially the cache (using both redis-cache and in-memory) I've noticed a very strange behaviour of the caching-mechanism.
At first the cache-settings by config.json passed into the directus-docker-container:
We are using a setup in the AWS (EC2-Linux-Instances, ElastiCache using Redis, RDS Aurora Serverless PostgreSQL10, EFS) but we were also able to reproduce the following behaviour locally with in-memory-cache and local-redis.
I've created a collection "Test" and added one item using the app. I connected to the redis-cache and run the "monitor"-call to show the redis-log.
Then i called directus on the items-endpoint to request the Test-items via "/items/Test":
The according log in the redis-cache looks as follows:
As you can see there is no "get" on a specific cache item except "permissions", but the actual content-item is not requested from the cache. But what is really strange to me is that the item itself is written to the cache again ("set") while it wasn't changed (GET-Request).
This behaviour is constant firing multiple GET-Requests to "/items/Test", the only thing changes is the expiration-date which increases from request to request (which would be correct in case of create or update):
The last thing I've tested was to change the value of the Test-item right in the postgres-database (postgres10) without using the api or the app at all:
and called the Test-items again (there were 2 items at this point):
The manual changes in the database were present by api immediately so the items were requested right from the database, not by cache.
To Reproduce
First approach
Second approach
Errors Shown
No response
What version of Directus are you using?
9.4.3 (production), 9.5.0 (local dev-environment)
What version of Node.js are you using?
16.13.1
What database are you using?
Postgres 10.14
What browser are you using?
Chrome
What operating system are you using?
macOS (locally), Amazon-Linux (production)
How are you deploying Directus?
Docker
The text was updated successfully, but these errors were encountered: