Skip to content

RanSatious/egg-node-cache

Repository files navigation

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);
  }
}

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published