Browse Source

name change

hotfix/0.7.1
Bryan Donovan 12 years ago
parent
commit
55009842e9
  1. 20
      README.md
  2. 8
      examples/example.js
  3. 4
      package.json

20
README.md

@ -1,4 +1,4 @@
node-cashew node-cache-manager
====================== ======================
# Flexible NodeJS cache module # Flexible NodeJS cache module
@ -18,11 +18,11 @@ priority cache(s) first.
## Installation ## Installation
npm install node-cashew npm install cache-manager
## Overview ## Overview
First, node-cashew features the standard functions you'd expect in most caches: First, node-cache-manager features the standard functions you'd expect in most caches:
set(key, val, cb) set(key, val, cb)
get(key, cb) get(key, cb)
@ -31,23 +31,23 @@ First, node-cashew features the standard functions you'd expect in most caches:
Second, it includes a `wrap` function that lets you wrap any function in cache. Second, it includes a `wrap` function that lets you wrap any function in cache.
(Note, this was inspired by [node-caching](https://github.com/mape/node-caching).) (Note, this was inspired by [node-caching](https://github.com/mape/node-caching).)
Third, node-cashew lets you set up a tiered cache strategy. This may be of Third, node-cache-manager lets you set up a tiered cache strategy. This may be of
limited use in most cases, but imagine a scenario where you expect tons of limited use in most cases, but imagine a scenario where you expect tons of
traffic, and don't want to hit Redis for every request. You decide to store traffic, and don't want to hit Redis for every request. You decide to store
the most commonly-requested data in an in-memory cache (like [node-lru-cache](https://github.com/isaacs/node-lru-cache)), the most commonly-requested data in an in-memory cache (like [node-lru-cache](https://github.com/isaacs/node-lru-cache)),
perhaps with a very short timeout and/or a small data size limit. But you perhaps with a very short timeout and/or a small data size limit. But you
still want to store the data in Redis for backup, and for the requests that still want to store the data in Redis for backup, and for the requests that
aren't as common as the ones you want to store in memory. This is something aren't as common as the ones you want to store in memory. This is something
node-cashew handles easily and transparently. node-cache-manager handles easily and transparently.
## Usage Examples ## Usage Examples
### Single Store ### Single Store
var cashew = require('cashew'); var cache_manager = require('cache-manager');
var redis_cache = cashew.caching({store: 'redis', db: 1, ttl: 100/*seconds*/}); var redis_cache = cache_manager.caching({store: 'redis', db: 1, ttl: 100/*seconds*/});
var memory_cache = cashew.caching({store: 'memory', max: 100, ttl: 10/*seconds*/}); var memory_cache = cache_manager.caching({store: 'memory', max: 100, ttl: 10/*seconds*/});
redis_cache.set('foo', 'bar', function(err) { redis_cache.set('foo', 'bar', function(err) {
if (err) { throw err; } if (err) { throw err; }
@ -90,7 +90,7 @@ node-cashew handles easily and transparently.
### Multi-Store ### Multi-Store
var multi_cache = cashew.multi_caching([memory_cache, redis_cache]); var multi_cache = cache_manager.multi_caching([memory_cache, redis_cache]);
user_id2 = 456; user_id2 = 456;
key2 = 'user_' + user_id; key2 = 'user_' + user_id;
@ -143,4 +143,4 @@ for any new features or bug fixes. Also run ``make`` before submitting the pull
## License ## License
node-cashew is licensed under the MIT license. node-cache-manager is licensed under the MIT license.

8
examples/example.js

@ -1,6 +1,6 @@
var cashew = require('cashew'); var cache_manager = require('cache-manager');
var redis_cache = cashew.caching({store: 'redis', db: 1, ttl: 100/*seconds*/}); var redis_cache = cache_manager.caching({store: 'redis', db: 1, ttl: 100/*seconds*/});
var memory_cache = cashew.caching({store: 'memory', max: 100, ttl: 10/*seconds*/}); var memory_cache = cache_manager.caching({store: 'memory', max: 100, ttl: 10/*seconds*/});
redis_cache.set('foo', 'bar', function(err) { redis_cache.set('foo', 'bar', function(err) {
if (err) { throw err; } if (err) { throw err; }
@ -41,7 +41,7 @@ redis_cache.wrap(key, function (cb) {
// { id: 123, name: 'Bob' } // { id: 123, name: 'Bob' }
var multi_cache = cashew.multi_caching([memory_cache, redis_cache]); var multi_cache = cache_manager.multi_caching([memory_cache, redis_cache]);
user_id2 = 456; user_id2 = 456;
key2 = 'user_' + user_id; key2 = 'user_' + user_id;

4
package.json

@ -8,7 +8,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/BryanDonovan/node-cashew.git" "url": "https://github.com/BryanDonovan/node-cache-manager.git"
}, },
"keywords": [ "keywords": [
"cache", "cache",
@ -23,13 +23,13 @@
"async": ">=0.1.22", "async": ">=0.1.22",
"hiredis": ">=0.1.14", "hiredis": ">=0.1.14",
"lru-cache": ">=2.3.0", "lru-cache": ">=2.3.0",
"optimist": ">=0.3.5",
"redis": ">=0.6.7" "redis": ">=0.6.7"
}, },
"devDependencies": { "devDependencies": {
"istanbul": ">=0.1.29", "istanbul": ">=0.1.29",
"jshint": ">=1.0.1", "jshint": ">=1.0.1",
"mocha": ">=1.8.1", "mocha": ">=1.8.1",
"optimist": ">=0.3.5",
"sinon": ">=1.5.2" "sinon": ">=1.5.2"
} }
} }

Loading…
Cancel
Save