{"id":46530,"library":"strapi-cache","title":"strapi-cache","description":"An LRU-Cache plugin for Strapi v5 that boosts API performance by caching REST and GraphQL responses. Current version 1.11.0, active development. Supports in-memory, Redis, and Valkey providers, with configurable TTL, max size, route exclusion, header caching, and custom key generation. Lightweight with zero overhead, integrates via Strapi's config/plugins file. Release cadence is frequent (multiple updates per month). Differentiator: dedicated Strapi v5 plugin with both REST and GraphQL caching, LRU strategy, and multiple storage backends.","status":"active","version":"1.11.0","language":"javascript","source_language":"en","source_url":"https://github.com/TupiC/strapi-cache","tags":["javascript","strapi cache","strapi rest cache","strapi 5 cache","strapi v5 cache plugin"],"install":[{"cmd":"npm install strapi-cache","lang":"bash","label":"npm"},{"cmd":"yarn add strapi-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add strapi-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to build as a Strapi plugin","package":"@strapi/sdk-plugin","optional":false},{"reason":"Core Strapi runtime","package":"@strapi/strapi","optional":false},{"reason":"Used by Strapi admin panel (plugin depends on it for admin UI if any)","package":"react","optional":true},{"reason":"React DOM for admin panel","package":"react-dom","optional":true},{"reason":"Routing for admin panel","package":"react-router-dom","optional":true},{"reason":"CSS-in-JS for admin panel components","package":"styled-components","optional":true}],"imports":[{"note":"This is a Strapi plugin, not a regular module. Configure via Strapi's config/plugins.js or config/plugins.ts. Do not import or require it directly in your code.","wrong":"const strapiCache = require('strapi-cache');","symbol":"strapi-cache plugin registration","correct":"// config/plugins.js or .ts\nmodule.exports = {\n  'strapi-cache': {\n    enabled: true,\n    config: {\n      provider: 'memory',\n      max: 1000,\n      ttl: 3600000\n    }\n  }\n}"},{"note":"In Strapi v5, the `env` function is a global available in config files (e.g., config/plugins.ts, config/database.ts) without separate import. Only import if you need it outside config.","wrong":"const { env } = require('@strapi/strapi');","symbol":"env() usage","correct":"import '@strapi/strapi'; // env is provided globally in Strapi config files\n\n// config/plugins.ts\n'strapi-cache': {\n  enabled: true,\n  config: {\n    redisConfig: env('REDIS_URL')\n  }\n}"},{"note":"Strapi plugins are configured via the `config/plugins.{js,ts}` file. Use `export default` for TypeScript, `module.exports` for JavaScript. Do not import the plugin package directly.","wrong":"import strapiCache from 'strapi-cache'; // wrong: direct import","symbol":"TypeScript config plugins","correct":"// config/plugins.ts\nexport default {\n  'strapi-cache': {\n    enabled: true,\n    config: {\n      provider: 'redis',\n      redisConfig: 'redis://localhost:6379'\n    }\n  }\n}"}],"quickstart":{"code":"// config/plugins.js\nmodule.exports = {\n  'strapi-cache': {\n    enabled: true,\n    config: {\n      provider: 'memory',\n      max: 500,\n      ttl: 1000 * 60 * 30,\n      size: 1024 * 1024 * 100,\n      cacheableRoutes: ['/api/products', '/api/categories'],\n      excludeRoutes: ['/api/products/private'],\n      cacheHeaders: true,\n      cacheHeadersDenyList: ['access-control-allow-origin'],\n      cacheAuthorizedRequests: false\n    }\n  }\n};","lang":"javascript","description":"Strapi v5 plugin configuration with in-memory cache: 500 items max, 30 min TTL, 100 MB size, caches /api/products and /api/categories but excludes /api/products/private, caches headers but not access-control-allow-origin."},"warnings":[{"fix":"Ensure your project runs Strapi v5.","message":"This plugin is designed exclusively for Strapi v5. Using it with older versions (v4 or below) will cause initialization failures.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If you need exact route matching, implement a custom keyGenerator or check the plugin source for more control.","message":"The `cacheableRoutes` config caches routes that START with the provided paths, not exact matches. E.g., '/api/products' will also cache '/api/products/featured'. Use regular expressions or exact matching if needed.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Provide a valid Redis/Valkey URL or config object in `redisConfig`.","message":"When `provider` is set to 'redis' or 'valkey', `redisConfig` is REQUIRED. Missing it will cause connection errors.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Order your lists accordingly; exclusions are evaluated after cacheable routes.","message":"The `excludeRoutes` takes precedence over `cacheableRoutes`. If a route matches both lists, it will be excluded.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Monitor release notes for final Valkey support. Prefer Redis for production.","message":"Support for Valkey is experimental and may change in future versions.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"}],"env_vars":null,"search_vec":"'1.11.0':24 '5':90 'activ':25 'api':14 'backend':82 'boost':13 'cach':3,7,17,43,76,85,88,91,94 'cadenc':59 'config/plugins':56 'configur':36 'current':22 'custom':45 'dedic':67 'develop':26 'differenti':66 'exclus':41 'file':57 'frequent':61 'generat':47 'graphql':20,75 'header':42 'in-memori':28 'integr':52 'javascript':83 'key':46 'lightweight':48 'lru':6,77 'lru-cach':5 'max':38 'memori':30 'month':65 'multipl':62,80 'overhead':51 'per':64 'perform':15 'plugin':8,70,95 'provid':34 'redi':31 'releas':58 'respons':21 'rest':18,73,87 'rout':40 'size':39 'storag':81 'strapi':2,10,54,68,84,86,89,92 'strapi-cach':1 'strategi':78 'support':27 'ttl':37 'updat':63 'v5':11,69,93 'valkey':33 'version':23 'via':53 'zero':50","created_at":"2026-06-07T13:00:22.322824+00:00","updated_at":"2026-06-07T13:00:22.322824+00:00","problems":[{"fix":"Run `npm install strapi-cache` in your project root.","cause":"The package is not installed or not in node_modules.","error":"Error: Cannot find module 'strapi-cache'"},{"fix":"Use `env` only inside config/plugins.{js,ts} or config/database.{js,ts} without importing. If needed elsewhere, import from '@strapi/strapi': `import { env } from '@strapi/strapi';`","cause":"Using `env` outside of Strapi config files where it is globally available.","error":"TypeError: env is not a function"},{"fix":"Set `provider: 'redis'` (or 'valkey') in the config object.","cause":"Setting `redisConfig` without explicitly setting `provider: 'redis'` (or 'valkey').","error":"Error: provider is required when using redis config"},{"fix":"Stop other Strapi instances or change the port in config/server.js via `yarn develop --port 1338`.","cause":"Another process is already using the default Strapi port (1337). Not directly related to strapi-cache but common in fresh installations.","error":"Error: listen EADDRINUSE :::1337"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/TupiC/strapi-cache#readme","github":"https://github.com/TupiC/strapi-cache","docs":null,"changelog":null,"pypi":null,"npm":"strapi-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}