Skip to content

Commit

Permalink
Allow cache id to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
wlaurance committed Feb 22, 2014
1 parent 12c304b commit 134689a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -4,7 +4,7 @@ var _ = require('underscore')
module.exports = function(config){
var cache = {};
var client = redis.connect(config.url);
var id = uuid.v1();
var id = config.id || uuid.v1();
cache.client = client;
function prefix() {
return id + ':'
Expand Down
3 changes: 3 additions & 0 deletions test/src-test.js
Expand Up @@ -47,6 +47,9 @@ describe('Simple Redis Cache', function(){
it('should have a function to get the cache id', function() {
assert.ok(cache.id())
})
it('should allow setting cache id', function() {
assert.equal(src({id:'id-test'}).id(), 'id-test')
})
it('should list the cache keys', function(done) {
var keys = _.map([
1,2,3,4,5,6,7,8,9,10,11,12
Expand Down

0 comments on commit 134689a

Please sign in to comment.