{"id":44819,"library":"egg-cache","title":"egg-cache","description":"Egg.js cache plugin based on cache-manager. Version 0.0.7 (released 2019) supports memory and external stores like Redis via cache-manager stores. Provides set/get/del/has/reset via app.cache, with optional TTL and closure/promise support. Low release cadence; no recent updates. Differentiator: integrates seamlessly into Egg.js lifecycle and configuration.","status":"maintenance","version":"0.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/hexindai/egg-cache","tags":["javascript","egg","eggPlugin","egg-plugin"],"install":[{"cmd":"npm install egg-cache","lang":"bash","label":"npm"},{"cmd":"yarn add egg-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add egg-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core caching abstraction layer","package":"cache-manager","optional":false}],"imports":[{"note":"Egg plugin registration, not a direct import. The plugin exposes app.cache.","wrong":"// Incorrect: not a regular import but a plugin declaration in Egg","symbol":"plugin","correct":"// config/plugin.js\nmodule.exports = {\n  cache: {\n    enable: true,\n    package: 'egg-cache',\n  },\n};"},{"note":"app.cache is available after plugin enable, not imported directly.","wrong":"const { cache } = require('egg-cache');","symbol":"app.cache","correct":"await app.cache.set('key', 'value');"},{"note":"Use app.cache.store(name) to get a specific store instance.","wrong":"app.cache.redis.set('foo', 'bar');","symbol":"store","correct":"const store = app.cache.store('redis');\nawait store.set('foo', 'bar');"}],"quickstart":{"code":"// Enable plugin in config/plugin.js\nmodule.exports = {\n  cache: {\n    enable: true,\n    package: 'egg-cache',\n  },\n};\n\n// Configure in config/config.default.js\nmodule.exports = {\n  cache: {\n    default: 'memory',\n    stores: {\n      memory: {\n        driver: 'memory',\n        max: 100,\n        ttl: 0,\n      },\n    },\n  },\n};\n\n// Use in your controller\nconst { ctx } = this;\nawait ctx.app.cache.set('foo', 'bar', 60);\nconst value = await ctx.app.cache.get('foo');\nconsole.log(value); // 'bar'","lang":"javascript","description":"Demonstrates Egg.js plugin configuration and basic cache set/get operations."},"warnings":[{"fix":"Stick to known working version or migrate to newer alternatives like egg-redis.","message":"Version 0.0.7 may have breaking changes from earlier versions; check CHANGELOG (missing)","severity":"breaking","affected_versions":"0.0.7"},{"fix":"Refer to cache-manager store docs for correct driver format.","message":"store name in config uses 'driver' key but actual store engine must provide a create() function","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Consider using @eggjs/cache or other actively maintained cache plugins.","message":"Package received no updates since 2019; cache-manager v3+ may introduce incompatible changes","severity":"deprecated","affected_versions":">=0.0.7"},{"fix":"Set ttl to a positive number or undefined to avoid ambiguity.","message":"ttl: 0 in config means no expiration? Check cache-manager docs: 0 may mean never expire but some stores treat differently","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'0.0.7':13 '2019':15 'app.cache':31 'base':7 'cach':3,5,10,25 'cache-manag':9,24 'cadenc':40 'closure/promise':36 'configur':51 'differenti':44 'egg':2,53,56 'egg-cach':1 'egg-plugin':55 'egg.js':4,48 'eggplugin':54 'extern':19 'integr':45 'javascript':52 'lifecycl':49 'like':21 'low':38 'manag':11,26 'memori':17 'option':33 'plugin':6,57 'provid':28 'recent':42 'redi':22 'releas':14,39 'seamless':46 'set/get/del/has/reset':29 'store':20,27 'support':16,37 'ttl':34 'updat':43 'version':12 'via':23,30","created_at":"2026-06-07T12:51:59.688629+00:00","updated_at":"2026-06-07T12:51:59.688629+00:00","problems":[{"fix":"Run: npm install egg-cache --save and add to config/plugin.js as described.","cause":"egg-cache not installed or plugin not enabled in config/plugin.js","error":"Cannot find module 'egg-cache'"},{"fix":"Check config/plugin.js has exports.cache = { enable: true, package: 'egg-cache' }","cause":"Plugin not loaded or disabled in config/plugin.js","error":"app.cache is undefined"}],"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/hexindai/egg-cache#readme","github":"https://github.com/hexindai/egg-cache","docs":null,"changelog":null,"pypi":null,"npm":"egg-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"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}}