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

cachegoose

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachegoose

Mongoose caching that actually works.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
823
decreased by-59.1%
Maintainers
1
Weekly downloads
 
Created
Source

#cachegoose

####Mongoose caching that actually works.

Build Status

##About

While looking for a Mongoose caching solution, I grew tired of packages that didn't work with the latest version of Mongoose, or that returned POJO's instead of Mongoose models. This inspired me to write cachegoose, A Mongoose caching module that works exactly how you would expect it to, with the latest version of Mongoose.

##Usage

var mongoose = require('mongoose');
var cachegoose = require('cachegoose');

cachegoose(mongoose, {
  engine: 'redis',    // If you don't specify the redis engine,
  port: 6379,         // the query results will be cached in memory.
  host: 'localhost'
});

Record
  .find({ some_condition: true })
  .cache(30) // The number of seconds to cache the query in Redis.  Defaults to 1 minute.
  .exec(function(err, records) {
    ...
  });

That's pretty much it. Just insert .cache() into the queries you want to cache, and they will be cached. Works with select, lean, sort, and anything else that will modify the results of a query.

##Test npm test

Keywords

FAQs

Package last updated on 24 Oct 2014

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