New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

cache-stack

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-stack

Utility that caches functions (until they expire) and stacks callbacks (for longer running functions).

latest
npmnpm
Version
0.1.0
Version published
Weekly downloads
4
33.33%
Maintainers
1
Weekly downloads
 
Created
Source

cache-stack

Utility that caches functions (until they expire) and stacks callbacks (for longer running functions).

npm install cache-stack

Usage

var cacheStack = require('cache-stack');

var cs = cacheStack(
  // db call, or some other longer running operation
  function(onResult) {
    Transaction.find({
      user: <MongoId>
    }).lean().exec(onResult);
  },

  { // everything, including this object, is optional
    key: 'unique-id-1234', // by default, cacheStack will try to create a key
                           // for the data based on the first argument.
                           // if you don't expect that to be unique, then pass
                           // a unique key here.
    expires: '+1 hour', // default is +1 minute
                        // milliseconds, seconds, minutes, hours, days, months, years
    debug: true, // outputs some console logs so that you can see what's happening.
                 // default is false
    useCache: true // set to false if you want a new execution of the function.
                   // default is true
  },

  function() {
    // do something when the function returns data
  }
);

// cs.clear(); to clear the cache immediately.

Keywords

mongo

FAQs

Package last updated on 03 Aug 2015

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