Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

egg-catbox

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-catbox

Catbox plugin for eggjs

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

egg-catbox

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Catbox plugin for egg framework.

Install

$ npm i egg-catbox --save

Usage

// {app_root}/config/plugin.js
exports.catbox = {
  enable: true,
  package: 'egg-catbox',
};

Configuration

// {app_root}/config/config.default.js
exports.catbox = {
};

see config/config.default.js for more detail.

Example

// {app_root}/app/service/user.js
const segment = 'segment';
module.exports = app => {
  class UserService extends app.Service {
    * save(user, ttl) {
      const id = 'id';
      const key = { id, segment };
      yield app.catbox.set(key, user, ttl);
    }
    * load(id) {
      const key = { id, segment };
      const result = yield app.catbox.get(key);
      return result ? result.item : null;
    }
    * drop(id) {
      const key = { id, segment };
      yield app.catbox.drop(key);
    }
  }
  return UserService;
}

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

FAQs

Package last updated on 18 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc