egg-node-cache
v1.0.0
Published
egg.js plugin for node-cache
Downloads
1
Readme
egg-node-cache
egg.js plugin for node-cache
Install
$ npm i egg-node-cache --save
Configuration
enable plugin
// {app_root}/config/plugin.js
exports.cache = {
enable: true,
package: 'egg-node-cache',
};
config
// {app_root}/config/config.default.js
exports.cache = {
client: {
// set more options at https://github.com/node-cache/node-cache#options
},
};
see config/config.default.js for more detail.
Usage
// {app_root}/app/service/cache.js
class CacheService extends Service {
get(key) {
this.ctx.app.cache.get(key);
}
set(key, value) {
this.ctx.app.cache.set(key, value);
}
}