egg-psyduck-cache

1.0.1 • Public • Published

egg-psyduck-cache

Egg plugin for cache

安装

$ npm i egg-psyduck-cache --save

支持的 egg 版本

egg 3.x egg 2.x egg 1.x
😁 😁

开启插件

// {app_root}/config/plugin.js
exports.cache = {
  enable: true,
  package: "egg-psyduck-cache",
};

配置

// {app_root}/config/config.default.js
config.cache = {
  ttl: 600, // 缓存时长(秒)
  fs: {
    path: path.join(appInfo.baseDir, "cache"),
    subdirs: false,
    zip: false,
  },
  redis: null,
};

示例

const result = await this.app.cache.fs.wrap("key", async () => {
  return await this.app.mysql.select("sql");
});

License

MIT

Package Sidebar

Install

npm i egg-psyduck-cache

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

15.4 kB

Total Files

5

Last publish

Collaborators

  • undsky