directus

Directus Api GET doesn't show changes instantly


I use directus as my cms and I use the API together with an React app. Whenever I update an Item, the update is instantly shown in the Directus UI. However if I directly afterwards fetch the table, with rest or graphql, I get the old, non changed item. It takes up to 10 minutes to finally get the updated data.

I also used a different instance of directus, and there everything works perfectly and everything is instantly upadted when fetching directly afterwards..

Does anyone have any idea what could be wrong?


Solution

  • To get the wanted behaviour, the cache settings can be adapted. Initially the CACHE_AUTO_PURGE is set to false, which results in the data being cashed 5 minutes until the new changes can be fetched. Just set the CACHE_AUTO_PURGE to true, to always get the newest changes.

    CACHE_AUTO_PURGE

    Automatically purge the data cache on actions that manipulate the data. Directus Docs