New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

datacache

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

datacache

Data caching in node.js

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

DataCache

DataCache is a utility module to provide straight-foward functionality to save data to a database (MongoDB for now) with an expiration time and the capacity to update the data at a regular interval.

Quick Examples

datacache.load({
    cacheKey:   'someCacheKey',
    expiration: '30',     // In Minutes
    refresh:    '20'      // In Minutes
  }, function(cacheCallback){
      ...
  },
  function(err, result){
      ...
  });

Download

Releases are available for download from GitHub. Alternatively, you can install using Node Package Manager (npm):

npm install datacache

Documentation

It's pretty simple. There is just one function call!

load(cacheObj, fn, callback)

Searches the database for a cacheKey and if found, it will return that data. If it's been refresh minutes since the cache was built, it will rebuild the cache after returning the result.

The second fn is what is called to create the data, just pass the final data into the cacheCallback function.

The callback is called with the result from the cache

FAQs

Package last updated on 16 Dec 2011

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