let me know how to delete or update cache for the model #96
Description
The cache doesn't return the updated data.
I used the default memory cache and following is my cache config in/config/middleware.js
cache: {
enabled: true,
enableEtagSupport: true,
enableXCacheHeaders: true,
withKoaContext: true,
withStrapiMiddleware: true,
clearRelatedCache: true,
maxAge: 3.154e10,
models: [
{
model: 'sqore-posts',
hitpass: false,
singleType: true,
routes: ['/sqore-posts/:slug', '/sqore-posts'],
},
],
},
After updating the content, updated data is not from API and only old cache data when calling /sqore-posts/:slug.
So I tried to clear or update the cache of model "sqore-posts" in the sqore-posts model.
but I don't know how to clear or update the cache.
I used this code in /models/sqore-posts.js.
afterUpdate: async (entry) => {
console.log('---------------sqore-posts afterUpdate')
const cacheConf = await strapi.middleware.cache.getCacheConfig('sqore-posts')
await strapi.middleware.cache.clearCache(cacheConf)
},
I am looking for your help.
Thanks.