Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Full configuration example:
cacheHeadersDenyList: ['access-control-allow-origin', 'content-encoding'], // Headers to exclude from the cache (must be lowercase, if empty array, no headers are excluded, cacheHeaders must be true)
cacheHeadersAllowList: ['content-type', 'content-security-policy'], // Headers to include in the cache (must be lowercase, if empty array, all headers are cached, cacheHeaders must be true)
cacheAuthorizedRequests: false, // Cache requests with authorization headers (set to true if you want to cache authorized requests)
cacheGetTimeoutInMs: 1000, // Timeout for getting cached data in milliseconds (default is 1 second)
cacheGetTimeoutInMs: 1000, // Timeout for getting cached data in milliseconds (default is 1 second, redis only)
autoPurgeCache: true, // Automatically purge cache on content CRUD operations
autoPurgeGraphQL: true, // Automatically purge GraphQL cache on content CRUD operations
autoPurgeCacheOnStart: true, // Automatically purge cache on Strapi startup
Expand Down Expand Up @@ -118,7 +118,7 @@ Possible configuration keys are listed below; omitted keys keep the plugin defau
| `cacheHeadersDenyList` | Header names (lowercase) to strip when `cacheHeaders` is `true` | Array of strings (default: `[]`) |
| `cacheHeadersAllowList` | If non-empty, only these header names (lowercase) are stored; if empty, all headers are stored (subject to deny list) | Array of strings (default: `[]`) |
| `cacheAuthorizedRequests` | Whether to cache requests that include an `Authorization` header | `true` or `false` (default: `false`) |
| `cacheGetTimeoutInMs` | Max time to wait for a cache read before treating it as a miss | Milliseconds (default: `1000`) |
| `cacheGetTimeoutInMs` | Max time to wait for a cache read before treating it as a miss (redis only) | Milliseconds (default: `1000`) |
| `autoPurgeCache` | Invalidate relevant REST cache entries after content create/update/delete | `true` or `false` (default: `true`) |
| `autoPurgeGraphQL` | Invalidate GraphQL cache after content create/update/delete | `true` or `false` (default: `false` if omitted; set `true` to enable) |
| `autoPurgeCacheOnStart` | Clear the cache when Strapi starts | `true` or `false` (default: `true`) |
Expand Down Expand Up @@ -161,4 +161,4 @@ If you encounter any issues, please feel free to open an issue on the [GitHub re

## 🛠️ Contributing

Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request.
Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request to the `dev` branch.
4 changes: 2 additions & 2 deletions admin/src/hooks/useCacheConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const useCacheConfig = (enabled: boolean = true) => {
setError(null);

try {
const { data } = await get('/strapi-cache/config');
const { data } = await get<CacheConfig>('/strapi-cache/config');
setConfig(data);
} catch (error: any) {
setError(error);
Expand All @@ -46,7 +46,7 @@ export const useCacheConfig = (enabled: boolean = true) => {
setError(null);

try {
const { data } = await get('/strapi-cache/config');
const { data } = await get<CacheConfig>('/strapi-cache/config');
setConfig(data);
} catch (error: any) {
setError(error);
Expand Down
3 changes: 2 additions & 1 deletion benchmark/cache.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const largeBody = {
})),
};
const largeCacheEntry = {
body: largeBody,
body: JSON.stringify(largeBody),
bodyType: 'json' as const,
headers: {
'content-type': 'application/json; charset=utf-8',
'cache-control': 'public, max-age=60',
Expand Down
Loading
Loading