Issue: Directus API GET Doesn't Show Changes Instantly
Possible Causes:
- Redis Caching: If you're using Redis for caching, it can delay the visibility of changes made through the API. To disable Redis caching, set the
- Cache Settings: Directus has cache settings that can affect the visibility of changes. By default,
CACHE_ENABLED
environment variable to false
.
CACHE_AUTO_PURGE
is set to false
, which means changes will be cached for 5 minutes before they're reflected in API responses. To ensure instant visibility of changes, set CACHE_AUTO_PURGE
to true
.
Solutions:
- Disable Redis Caching: Open your
.env
file and add the following line:CACHE_ENABLED = false
Adjust Cache Settings:
Open your .env
file and add the following line:CACHE_AUTO_PURGE = true
Explanation:
Redis caching can improve performance by storing frequently requested data in memory for faster retrieval. However, if you need to see changes immediately after making them through the API, you'll need to disable Redis caching.
The CACHE_AUTO_PURGE
setting controls how Directus handles caching for data manipulation actions. When set to false
, changes are cached for 5 minutes before they're reflected in API responses. Setting it to true
ensures that changes are always reflected immediately.
By adjusting these settings, you can ensure that changes made through the Directus API are reflected instantly in subsequent API requests.