{"_id":"@10life/strapi-plugin-advanced-cache-manager","_rev":"6-ddaf96f55413d7a6b81af9771000c5e6","name":"@10life/strapi-plugin-advanced-cache-manager","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.1":{"name":"@10life/strapi-plugin-advanced-cache-manager","version":"1.0.1","description":"A Cache Management for Strapi.","strapi":{"name":"Advanced Cache Manager","description":"A Cache Management for Strapi.","kind":"plugin","displayName":"Advanced Cache Manager"},"dependencies":{"apollo-server-cache-redis":"3.3.1","apollo-server-core":"3.12.1","apollo-server-plugin-response-cache":"3.8.2","aws-sdk":"^2.1305.0"},"peerDependencies":{"@strapi/strapi":"^4.4.0"},"author":{"name":"Roy To"},"maintainers":[{"name":"10life","email":"subscription@10life.com"}],"engines":{"npm":">=6.0.0"},"license":"MIT","_id":"@10life/strapi-plugin-advanced-cache-manager@1.0.1","gitHead":"957b48b85d42b6ab39c9f4acea30e48d8c640aa2","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-2Bn78Ht4fI2oofseK8gfnwVFrC4SFwWkywcaQ6Td29DOMqxH/oZaqvekPRTSFgLSfJz9tMsHqY0caZpwj4XeKQ==","shasum":"a6f1264cf34f86f3f7f680d0e78af28a95dee4aa","tarball":"https://registry.npmjs.org/@10life/strapi-plugin-advanced-cache-manager/-/strapi-plugin-advanced-cache-manager-1.0.1.tgz","fileCount":33,"unpackedSize":23990,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG22fTPJ3R7hNo2V0y6CV8HCZXRYe0rGh86L4tEQbzfPAiBStVvAzJSDp/akDInyfbr52n+ZqXRbtriJTeU0XszRLQ=="}]},"_npmUser":{"name":"10life","email":"subscription@10life.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strapi-plugin-advanced-cache-manager_1.0.1_1701424947369_0.7659877884374984"},"_hasShrinkwrap":false},"1.0.2":{"name":"@10life/strapi-plugin-advanced-cache-manager","version":"1.0.2","description":"A Cache Management for Strapi.","strapi":{"name":"advanced-cache-manager","description":"A Cache Management for Strapi.","kind":"plugin","displayName":"Advanced Cache Manager"},"dependencies":{"apollo-server-cache-redis":"3.3.1","apollo-server-core":"3.12.1","apollo-server-plugin-response-cache":"3.8.2","aws-sdk":"^2.1305.0"},"peerDependencies":{"@strapi/strapi":"^4.4.0"},"author":{"name":"Roy To"},"maintainers":[{"name":"10life","email":"subscription@10life.com"}],"engines":{"npm":">=6.0.0"},"license":"MIT","_id":"@10life/strapi-plugin-advanced-cache-manager@1.0.2","gitHead":"9ca6b1d7a0ae95053b18066703da0f956fb8c12b","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-kUgW7H28DN/Teo5Ki1zLNljpSFc2C+N/xA9IV43VEZ9tnCSIPNM4pPSjJs0HTcFWbIs/k+iWUKy+yV1dRlqkxQ==","shasum":"e13bb0155e7e658624286964aeba4eb6222f09ce","tarball":"https://registry.npmjs.org/@10life/strapi-plugin-advanced-cache-manager/-/strapi-plugin-advanced-cache-manager-1.0.2.tgz","fileCount":33,"unpackedSize":23990,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDpeFoJdLbx92O1YqcSFXTjMWtwPN/t3Wrq2hJjJuDn4AiEA53L48qPC1gHvqEVFOIqgrxVQYqmzPy+QJZPAcrJlYkg="}]},"_npmUser":{"name":"10life","email":"subscription@10life.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strapi-plugin-advanced-cache-manager_1.0.2_1701425948041_0.06840032720472933"},"_hasShrinkwrap":false},"1.0.3":{"name":"@10life/strapi-plugin-advanced-cache-manager","version":"1.0.3","description":"A Cache Management for Strapi.","strapi":{"name":"advanced-cache-manager","description":"A Cache Management for Strapi.","kind":"plugin","displayName":"Advanced Cache Manager"},"dependencies":{"apollo-server-cache-redis":"3.3.1","apollo-server-core":"3.12.1","apollo-server-plugin-response-cache":"3.8.2","aws-sdk":"^2.1305.0"},"peerDependencies":{"@strapi/strapi":"^4.4.0"},"author":{"name":"Roy To"},"maintainers":[{"name":"10life","email":"subscription@10life.com"}],"engines":{"npm":">=6.0.0"},"license":"MIT","_id":"@10life/strapi-plugin-advanced-cache-manager@1.0.3","gitHead":"c632ea9a49d8fdef9f9f0938f128efefdbe39124","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-ukNocYZuhrvbAxmBq92HIxUEVYMX4U6TvVhgLSkJVH4wYsDzlrwBJYyGvOAgjUZfEt3WJjIdGypN9N2MIJVuxg==","shasum":"240fbdb7fe8c60ffe9f4780ee0e09b3d5ed4290b","tarball":"https://registry.npmjs.org/@10life/strapi-plugin-advanced-cache-manager/-/strapi-plugin-advanced-cache-manager-1.0.3.tgz","fileCount":33,"unpackedSize":27105,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDvEmHey0Qr8JsLDi3joPxj4wQxl48B+AxN1mqH0GJ90AiA2lG/n34UUF+arppX6CeboXbBty3S+WOSZu9UEmkpYGQ=="}]},"_npmUser":{"name":"10life","email":"subscription@10life.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strapi-plugin-advanced-cache-manager_1.0.3_1701660904229_0.30522217695711795"},"_hasShrinkwrap":false},"1.0.4":{"name":"@10life/strapi-plugin-advanced-cache-manager","version":"1.0.4","description":"A Cache Management for Strapi.","strapi":{"name":"advanced-cache-manager","description":"A Cache Management for Strapi.","kind":"plugin","displayName":"Advanced Cache Manager"},"repository":{"type":"git","url":"git+https://github.com/10Life/strapi-plugin-advanced-cache-manager.git"},"keywords":["strapi","cache","graphql","cdn"],"dependencies":{"apollo-server-cache-redis":"3.3.1","apollo-server-core":"3.12.1","apollo-server-plugin-response-cache":"3.8.2","aws-sdk":"^2.1305.0"},"peerDependencies":{"@strapi/strapi":"^4.4.0"},"author":{"name":"Roy To"},"maintainers":[{"name":"10life","email":"subscription@10life.com"}],"engines":{"npm":">=6.0.0"},"license":"MIT","_id":"@10life/strapi-plugin-advanced-cache-manager@1.0.4","gitHead":"a678b5cf75ee78ae67e2767140d833dd710bdfaf","bugs":{"url":"https://github.com/10Life/strapi-plugin-advanced-cache-manager/issues"},"homepage":"https://github.com/10Life/strapi-plugin-advanced-cache-manager#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-OcYk3nf/Ely1rAXZcnVaJTD1zAK4jInT+S9AD7/PfezDYrMHDBg3m4ctvFU8oU8k1zeqysgd/4P1fqH5FSLh4g==","shasum":"1cf59080b3c71d2e0b16c21cf3438c03c5382342","tarball":"https://registry.npmjs.org/@10life/strapi-plugin-advanced-cache-manager/-/strapi-plugin-advanced-cache-manager-1.0.4.tgz","fileCount":33,"unpackedSize":27544,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEFRXOQqFtHu8/Wb6nvhbPR2ncdipVKgwGafWS6nfCyXAiAOa4iN4Iz7l4b1jxNCNatyOzrWsFKwsziGAPlbg38Ofg=="}]},"_npmUser":{"name":"10life","email":"subscription@10life.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strapi-plugin-advanced-cache-manager_1.0.4_1701662327922_0.9931933807660052"},"_hasShrinkwrap":false},"1.0.5":{"name":"@10life/strapi-plugin-advanced-cache-manager","version":"1.0.5","description":"A Cache Management for Strapi.","strapi":{"name":"advanced-cache-manager","description":"A Cache Management for Strapi.","kind":"plugin","displayName":"Advanced Cache Manager"},"repository":{"type":"git","url":"git+https://github.com/10Life/strapi-plugin-advanced-cache-manager.git"},"keywords":["strapi","cache","graphql","cdn"],"dependencies":{"apollo-server-cache-redis":"3.3.1","apollo-server-core":"3.12.1","apollo-server-plugin-response-cache":"3.8.2","aws-sdk":"^2.1305.0"},"peerDependencies":{"@strapi/strapi":"^4.4.0"},"author":{"name":"Roy To"},"maintainers":[{"name":"10life","email":"subscription@10life.com"},{"name":"royanon","email":"roy.anonymous@gmail.com"}],"engines":{"npm":">=6.0.0"},"license":"MIT","_id":"@10life/strapi-plugin-advanced-cache-manager@1.0.5","gitHead":"b64ff0256967dbb58a4f990a95bef9950f8fcabc","bugs":{"url":"https://github.com/10Life/strapi-plugin-advanced-cache-manager/issues"},"homepage":"https://github.com/10Life/strapi-plugin-advanced-cache-manager#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-mohgJnxNS30mom5XoVxow1jaFn04O3tm7uNWSn5eijGVOiU4rHeYWpR7zOseJ0azMBB4ouKnunEBj8lI9/TLWQ==","shasum":"134504a054b79a03253e6031bca751a3d8487b18","tarball":"https://registry.npmjs.org/@10life/strapi-plugin-advanced-cache-manager/-/strapi-plugin-advanced-cache-manager-1.0.5.tgz","fileCount":33,"unpackedSize":28644,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiXzwXeYcW9Th92LhuCQ78JK4KuVxTihLBMDr8scn7dgIge4/TNVXRECxtuQogZhDaRYIrmIc55b5ebSkMehylDt4="}]},"_npmUser":{"name":"10life","email":"subscription@10life.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strapi-plugin-advanced-cache-manager_1.0.5_1701686259927_0.21051948400495712"},"_hasShrinkwrap":false},"1.0.6":{"name":"@10life/strapi-plugin-advanced-cache-manager","version":"1.0.6","description":"A Cache Management for Strapi.","strapi":{"name":"advanced-cache-manager","description":"A Cache Management for Strapi.","kind":"plugin","displayName":"Advanced Cache Manager"},"repository":{"type":"git","url":"git+https://github.com/10Life/strapi-plugin-advanced-cache-manager.git"},"keywords":["strapi","cache","graphql","cdn"],"dependencies":{"apollo-server-cache-redis":"3.3.1","apollo-server-core":"3.12.1","apollo-server-plugin-response-cache":"3.8.2","aws-sdk":"^2.1305.0"},"peerDependencies":{"@strapi/strapi":"^4.4.0"},"author":{"name":"Roy To"},"maintainers":[{"name":"10life","email":"subscription@10life.com"},{"name":"royanon","email":"roy.anonymous@gmail.com"}],"engines":{"npm":">=6.0.0"},"license":"MIT","_id":"@10life/strapi-plugin-advanced-cache-manager@1.0.6","gitHead":"bd4615d969192c0dfaf46897c7094ba41e89f266","bugs":{"url":"https://github.com/10Life/strapi-plugin-advanced-cache-manager/issues"},"homepage":"https://github.com/10Life/strapi-plugin-advanced-cache-manager#readme","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-I8wPv4pvJCLz67lsqxVq0yjeabOxk2AulCmw3GEBVoIJAB+/tzDIeML4Rt8VEkjITwUfCz3nMJ3EyB0IPuH+jA==","shasum":"9392eacd22069a0db30cfe12a51da23557a2718a","tarball":"https://registry.npmjs.org/@10life/strapi-plugin-advanced-cache-manager/-/strapi-plugin-advanced-cache-manager-1.0.6.tgz","fileCount":33,"unpackedSize":28701,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH5BeFtcKWjEdvcTaeTszM2IqMm/B+0wbu031LI97OsCAiAxJcgu6MwkSuh0qfxwcm0T1YfFECcFx+Uwg1aaf57WwQ=="}]},"_npmUser":{"name":"10life","email":"subscription@10life.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strapi-plugin-advanced-cache-manager_1.0.6_1701688385918_0.8618992653405633"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-01T10:02:27.261Z","1.0.1":"2023-12-01T10:02:27.562Z","modified":"2023-12-04T11:13:06.318Z","1.0.2":"2023-12-01T10:19:08.257Z","1.0.3":"2023-12-04T03:35:04.537Z","1.0.4":"2023-12-04T03:58:48.104Z","1.0.5":"2023-12-04T10:37:40.079Z","1.0.6":"2023-12-04T11:13:06.128Z"},"maintainers":[{"name":"10life","email":"subscription@10life.com"},{"name":"royanon","email":"roy.anonymous@gmail.com"}],"description":"A Cache Management for Strapi.","author":{"name":"Roy To"},"license":"MIT","readme":"# strapi-plugin-advanced-cache-manager\r\nAn advanced cache management plugin for Strapi.\r\n\r\nStrapi v4 GraphQL plugin does not come with a cache feature out of the box. A third-party plugin, apollo-server-plugin-response-cache, is used to enable caching, but it does not have a cache invalidation logic. There is another forked project that has a cache invalidation logic, but it only works when GraphQL mutations are executed. This is not suitable for users who create or update data inside Strapi or by direct SQL queries.\r\n\r\nThis plugin allows Strapi users to invalidate the cache according to the cache time defined in the plugin options. Besides, it also provides a way for users to clear AWS CDN cache.\r\n\r\n# How to use\r\nPut this at the top of `/config/plugins.js`:\r\n```\r\nconst { RedisCache } = require('apollo-server-cache-redis');\r\nconst apolloServerPluginResponseCache = require('apollo-server-plugin-response-cache').default;\r\nconst ApolloServerPluginCacheControl = require('apollo-server-core').ApolloServerPluginCacheControl;\r\n```\r\n\r\nTo enable GraphQL caching, put the following code in your GraphQL config in `/config/plugins.js`:\r\n\r\n```\r\n  graphql: {\r\n    enabled: true,\r\n    config: {\r\n        apolloServer: {\r\n            // use redis for storing cache\r\n            cache: (() => {\r\n              if (env('REDIS_HOST')) {\r\n                const redisCache = new RedisCache({\r\n                    host: env('REDIS_HOST'),\r\n                    password: env('REDIS_PASSWORD')\r\n                });\r\n                redisCache.cacheType = 'RedisCache';\r\n                return redisCache;\r\n              }\r\n            })(),\r\n            plugins: [\r\n              // cache behavior lower age override higher age\r\n              ApolloServerPluginCacheControl({ defaultMaxAge: env('STRAPI_GRAPHQL_DEFAULT_MAX_AGE') }),\r\n              // customize your cache behavior according to your use case\r\n              apolloServerPluginResponseCache({\r\n                shouldReadFromCache: async(requestContext) => {\r\n                  return true;\r\n                },\r\n                shouldWriteToCache: async(requestContext) => {\r\n                  return true;\r\n                },\r\n                extraCacheKeyData: async(requestContext) => {\r\n                  return true;\r\n                },\r\n                sessionId: async (requestContext) => {\r\n                  return null;\r\n                },\r\n              }),                \r\n            ]\r\n        },\r\n    },\r\n  },\r\n\r\n```\r\n\r\nTo enable this plugin, put the following code in `/config/plugin.js`:\r\n\r\n```\r\n  'advanced-cache-manager': {\r\n    enabled: true,\r\n    config: {\r\n      max_age: env('STRAPI_GRAPHQL_MAX_AGE'),\r\n      cache_control_matrix: [\r\n        { query: 'usersPermissionsUser', maxAge: 0, scope: \"PRIVATE\" },\r\n        { query: 'examplePosts', maxAge: env('STRAPI_GRAPHQL_MAX_AGE'), scope: \"PUBLIC\" },\r\n      ],\r\n      aws_config: {\r\n        accessKeyId: env('STRAPI_AWS_ACCESS_KEY_ID'),\r\n        secretAccessKey: env('STRAPI_AWS_ACCESS_SECRET'),\r\n        region: env('STRAPI_AWS_REGION'),\r\n      }\r\n    }\r\n  },\r\n```\r\n\r\nPrepare the environment variables as follows:\r\n```\r\nREDIS_HOST\r\nREDIS_PASSWORD\r\nSTRAPI_GRAPHQL_DEFAULT_MAX_AGE\r\nSTRAPI_GRAPHQL_MAX_AGE\r\nSTRAPI_AWS_ACCESS_KEY_ID\r\nSTRAPI_AWS_ACCESS_SECRET\r\nSTRAPI_AWS_REGION\r\n```\r\n\r\n# Cache administration\r\nYou can customize the cache scope and maxAge according to your needs. By default, entities will be cached by STRAPI_GRAPHQL_DEFAULT_MAX_AGE. The cache_control_matrix option can override the cache settings for specific entities by STRAPI_GRAPHQL_MAX_AGE. This plugin provides an admin page to clear the cache according to the cache maxAge. You can choose to clear the short cache (STRAPI_GRAPHQL_DEFAULT_MAX_AGE) or clear all the cache in Redis.\r\n\r\nThe admin page also provides the CDN cache clearing function. It will clear all the CDN cache.\r\n\r\n# Road map\r\n- A scheduled cache clearing feature\r\n- A cache clearing pattern input for CDN cache\r\n\r\n# Contributing\r\nThis section covers the way how to configure your environment if you want to contribute to this package.\r\n\r\nSetting up the environment\r\nIn order to start making changes in the plugin you first need to install Strapi infrastructure on top of the plugin repository.\r\n\r\n```\r\nnpx create-strapi-app --quickstart strapi\r\ncd strapi\r\n```\r\n\r\nBy default Strapi does not create plugins folder so we need to create it.\r\n```\r\nmkdir -p src/plugins\r\n```\r\n\r\nNow we should clone this repository so we can work on it.\r\n```\r\ngit clone https://github.com/10Life/strapi-plugin-advanced-cache-manager.git\r\n```\r\n\r\nInstall dependencies:\r\n```\r\nnpm install\r\n```\r\n\r\nNow we need to register plugin so strapi can use it. In order to do that we need to create (if not already created) `./config/plugins.js` file and add entry to it. (Follow How to use section)\r\n```\r\nmodule.exports = ({ env }) => ({\r\n  \"advanced-cache-manager\": {\r\n    enabled: true,\r\n    // add this line\r\n    resolve: \"./src/plugins/strapi-plugin-advanced-cache-manager\r\n    // rest of the configuration\r\n  },\r\n});\r\n```\r\n\r\nRebuild the project and start the server:\r\n```\r\nnpm run build\r\nnpm run develop\r\n```\r\n\r\n","readmeFilename":"README.md","homepage":"https://github.com/10Life/strapi-plugin-advanced-cache-manager#readme","keywords":["strapi","cache","graphql","cdn"],"repository":{"type":"git","url":"git+https://github.com/10Life/strapi-plugin-advanced-cache-manager.git"},"bugs":{"url":"https://github.com/10Life/strapi-plugin-advanced-cache-manager/issues"}}