Issue: Directus API GET requests may not reflect changes made to the data immediately, resulting in outdated or inaccurate information being displayed.
Possible Cause: Caching is enabled in Directus, which can cause a delay in the propagation of changes.
Solution 1: Disable Redis Caching:
If you're using Redis for caching, disable it by setting the CACHE_ENABLED environment variable to false. This will ensure that changes are reflected immediately in API responses. CACHE_ENABLED = false
Solution 2: Enable Automatic Cache Purging:
Set the CACHE_AUTO_PURGE environment variable to true. This will cause Directus to automatically purge the cache whenever data is modified, ensuring that API responses always contain the latest information. CACHE_AUTO_PURGE = true
Explanation:
Directus uses caching to improve performance by storing frequently requested data in memory. However, this can lead to a delay in the propagation of changes if the cache is not properly configured. Disabling caching or enabling automatic cache purging ensures that API responses always reflect the most up-to-date data.
Additional Information:
- Refer to the Directus documentation for more details on caching configuration: Directus Docs
- Restart Directus after making changes to the environment variables for the changes to take effect.