Comments (4)
Hello @yulafezmesi
Can you enable debug mode with DEBUG=strapi:strapi-plugin-rest-cache yarn develop
and share your plugin config ?
It will show you on which route purge middleware is registered, and also when a purge is emitted.
from strapi-plugin-rest-cache.
Here is the output:
{
debug: false,
enableEtag: false,
enableXCacheHeaders: false,
enableAdminCTBMiddleware: true,
resetOnStartup: false,
clearRelatedCache: true,
maxAge: 3600000,
keysPrefix: '',
contentTypes: [
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::activity.activity',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::location.location',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::offer.offer',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::package.package',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::extra.extra',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::activity-provider.activity-provider',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::review.review',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::image.image',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::district.district',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::city.city',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::postal-code.postal-code',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::image-category.image-category',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::image-type.image-type',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: [Function: hitpass],
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::corona-opening-model.corona-opening-model',
relatedContentTypeUid: [Array]
}
],
keys: CacheKeysConfig { useHeaders: [], useQueryParams: true }
}
from strapi-plugin-rest-cache.
It should also show you something like this on startup:
strapi:strapi-plugin-rest-cache [REGISTER] api::homepage.homepage routes middlewares +0ms
strapi:strapi-plugin-rest-cache [REGISTER] GET /api/homepage recv maxAge=3600000 +0ms
strapi:strapi-plugin-rest-cache [REGISTER] api::global.global routes middlewares +0ms
strapi:strapi-plugin-rest-cache [REGISTER] GET /api/global recv maxAge=3600000 +0ms
strapi:strapi-plugin-rest-cache [REGISTER] api::page.page routes middlewares +0ms
strapi:strapi-plugin-rest-cache [REGISTER] GET /api/pages/slug/:uri+ recv maxAge=3600000 +0ms
strapi:strapi-plugin-rest-cache [REGISTER] POST /api/pages purge +0ms
strapi:strapi-plugin-rest-cache [REGISTER] DELETE /api/pages/:id purge +1ms
strapi:strapi-plugin-rest-cache [REGISTER] PUT /api/pages/:id purge +0ms
strapi:strapi-plugin-rest-cache [REGISTER] GET /api/pages recv maxAge=3600000 +0ms
strapi:strapi-plugin-rest-cache [REGISTER] GET /api/pages/:id recv maxAge=3600000 +0ms
strapi:strapi-plugin-rest-cache [REGISTER] admin routes middlewares +0ms
strapi:strapi-plugin-rest-cache [REGISTER] POST /content-manager/single-types/:model/actions/publish purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] POST /content-manager/single-types/:model/actions/unpublish purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] POST /content-manager/collection-types/:model purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] POST /content-manager/collection-types/:model/:id/actions/publish purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] POST /content-manager/collection-types/:model/:id/actions/unpublish purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] POST /content-manager/collection-types/:model/actions/bulkDelete purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] PUT /content-manager/single-types/:model purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] PUT /content-manager/collection-types/:model/:id purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] DELETE /content-manager/single-types/:model purge-admin +0ms
strapi:strapi-plugin-rest-cache [REGISTER] DELETE /content-manager/collection-types/:model/:id purge-admin +1ms
and when you update an entity on the admin, you should see which keys are purged:
strapi:strapi-plugin-rest-cache [PURGING KEY]: /api/pages?& +0ms
strapi:strapi-plugin-rest-cache [PURGING KEY]: /api/pages/1?& +0ms
strapi:strapi-plugin-rest-cache [PURGING KEY]: /api/pages/slug/example?& +0ms
[2022-03-09 15:06:21.557] http: PUT /content-manager/collection-types/api::page.page/1 (393 ms) 200
Also, can you share your plugin config form config/plugins.js
?
from strapi-plugin-rest-cache.
I am having the same issue:
Here is the debug startup
{
debug: false,
enableEtag: false,
enableXCacheHeaders: true,
enableAdminCTBMiddleware: true,
resetOnStartup: false,
clearRelatedCache: true,
maxAge: 3600000,
keysPrefix: '',
contentTypes: [
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::course.course',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::lesson.lesson',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::order.order',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::product.product',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::lead.lead',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::agent.agent',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::contact.contact',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::opportunity.opportunity',
relatedContentTypeUid: [Array]
},
CacheContentTypeConfig {
singleType: false,
injectDefaultRoutes: true,
maxAge: 3600000,
hitpass: false,
keys: [CacheKeysConfig],
plugin: undefined,
routes: [Array],
contentType: 'api::account.account',
relatedContentTypeUid: [Array]
}
],
keys: CacheKeysConfig { useHeaders: [], useQueryParams: true }
}
Here is my response when I update the admin
[2022-03-09 15:18:23.612] http: GET /api/products?where%5Bwebsites%5D%5B%24in%5D%5B0%5D=6 (52 ms) 200
strapi:strapi-plugin-rest-cache [RECV] GET /api/agents?filters={"contact":{"id":"1"}},populate="frc"& HIT +67ms
[2022-03-09 15:18:23.679] http: GET /api/agents?filters%5Bcontact%5D%5Bid%5D=1&populate=frc (50 ms) 200
[2022-03-09 15:20:20.187] http: PUT /content-manager/collection-types/api::agent.agent/1 (3789 ms) 200
Here is my config
module.exports = ({ env }) => ({
redis: {
config: {
connections: {
default: {
connection: {
host: config.host,
port: config.port,
user: config.user,
db: 0,
password: config.password,
},
settings: {
debug: true,
cluster: false,
},
}
}
}
},
"rest-cache": {
config: {
provider: {
name: "redis",
options: {
max: 1000,
connection: "default",
},
},
strategy: {
enableXCacheHeaders: true,
hitpass: false,
clearRelatedCache: true,
contentTypes: [
"api::course.course",
"api::lesson.lesson",
"api::product.product",
"api::lead.lead",
"api::agent.agent",
"api::contact.contact",
"api::opportunity.opportunity",
"api::account.account"
]
}
}
},
});
Hope this helps. I might have setup something wrong as well.
from strapi-plugin-rest-cache.
Related Issues (20)
- Strapi-plugin-rest-cache with memory provider causing missing thumbnail URLs in API responses HOT 5
- Any way to cache only plural and not singular endpoints? HOT 4
- Strategy documentation should show "hitpass: false" by default
- maxAge on memory provider seems wrong HOT 4
- purgeAdmin should also send request.body to cacheStore.clearByUid
- Routes not register on @strapi/[email protected] HOT 2
- Implement RFC-01 for changing the way cache middlewares are injected into the application
- Does not clear cache when a relation has been updated HOT 5
- Connect a plugin with sentinels 3 nodes HOT 2
- Caching not only 'factory' content types HOT 3
- Bulk Publish/Unpublish: Cache not busted
- Cache ignoring: Route not registered in strapi, ignoring... HOT 1
- Cannot purge in Windows HOT 11
- Track cache hits HOT 2
- Strapi Rest Cache Plugin Is Not Working HOT 2
- refresh page issue it renders json chunks , not html,please help HOT 1
- Stuck can't start the plugin (see Image) HOT 27
- Plugin ignores the header in useHeaders option HOT 2
- Caching issue HOT 1
- Cache-Control header is not set in response.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strapi-plugin-rest-cache.