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

cacheit

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheit

A simple Redis cache

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

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

A simple Redis Cache using node-redis

NOTE: This is only meant to be used with local redis servers

API

Constructor

var Cache = require('cacheit');
var cache = new Cache();

cache.set(key, value, [ttl], [callback])

  • key - string
  • value - string or hash object (must be flat)
  • ttl - time to live in m
  • callback

cache.setHash(key, valuue, [ttl], [callback])

An alias for cache.set. This is just for symmetry with cache.getHash.

cache.get(key, callback)

key - string

Returns the string value or 'undefined' if the key is not found.

cache.getHash(key, callback)

key - string

Returns the entire hash object using the redis 'HGETALL' command.

cache.delete(key, callback)

key - string

Deletes the key using the redis 'DEL' command.

cache.total_keys(callback)

Returns the total number of keys currently cached

Properties

  • cache.client - access the raw redis client
  • cache.hits
  • cache.misses
  • cache.errors
  • cache.default_ttl
  • cache.connects
  • cache.disconnects
  • cache.connected

Tests

Ensure you have a local version of redis running.

Install mocha

npm install mocha

Run tests

cd test
mocha test.js --reporter spec

FAQs

Package last updated on 26 Mar 2012

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