diff --git a/README.md b/README.md index dbf0234..626f64e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -node-cashew +node-cache-manager ====================== # Flexible NodeJS cache module @@ -18,11 +18,11 @@ priority cache(s) first. ## Installation - npm install node-cashew + npm install cache-manager ## 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) 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. (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 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)), 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 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 ### Single Store - var cashew = require('cashew'); - var redis_cache = cashew.caching({store: 'redis', db: 1, ttl: 100/*seconds*/}); - var memory_cache = cashew.caching({store: 'memory', max: 100, ttl: 10/*seconds*/}); + var cache_manager = require('cache-manager'); + var redis_cache = cache_manager.caching({store: 'redis', db: 1, ttl: 100/*seconds*/}); + var memory_cache = cache_manager.caching({store: 'memory', max: 100, ttl: 10/*seconds*/}); redis_cache.set('foo', 'bar', function(err) { if (err) { throw err; } @@ -90,7 +90,7 @@ node-cashew handles easily and transparently. ### 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; key2 = 'user_' + user_id; @@ -143,4 +143,4 @@ for any new features or bug fixes. Also run ``make`` before submitting the pull ## License -node-cashew is licensed under the MIT license. +node-cache-manager is licensed under the MIT license. diff --git a/examples/example.js b/examples/example.js index 1106a9e..5d27cda 100644 --- a/examples/example.js +++ b/examples/example.js @@ -1,6 +1,6 @@ -var cashew = require('cashew'); -var redis_cache = cashew.caching({store: 'redis', db: 1, ttl: 100/*seconds*/}); -var memory_cache = cashew.caching({store: 'memory', max: 100, ttl: 10/*seconds*/}); +var cache_manager = require('cache-manager'); +var redis_cache = cache_manager.caching({store: 'redis', db: 1, ttl: 100/*seconds*/}); +var memory_cache = cache_manager.caching({store: 'memory', max: 100, ttl: 10/*seconds*/}); redis_cache.set('foo', 'bar', function(err) { if (err) { throw err; } @@ -41,7 +41,7 @@ redis_cache.wrap(key, function (cb) { // { 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; key2 = 'user_' + user_id; diff --git a/package.json b/package.json index 3ab6b79..a93faee 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/BryanDonovan/node-cashew.git" + "url": "https://github.com/BryanDonovan/node-cache-manager.git" }, "keywords": [ "cache", @@ -23,13 +23,13 @@ "async": ">=0.1.22", "hiredis": ">=0.1.14", "lru-cache": ">=2.3.0", - "optimist": ">=0.3.5", "redis": ">=0.6.7" }, "devDependencies": { "istanbul": ">=0.1.29", "jshint": ">=1.0.1", "mocha": ">=1.8.1", + "optimist": ">=0.3.5", "sinon": ">=1.5.2" } }