cache-service
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -15,2 +15,5 @@ var cacheCollection = require('./cacheCollection'); | ||
self.get = function(key, cb){ | ||
if(arguments.length < 2){ | ||
throw new exception('INCORRECT_ARGUMENT_EXCEPTION', '.get() requires 2 arguments.'); | ||
} | ||
self.log(false, 'get() called for key:', {key: key}); | ||
@@ -49,2 +52,5 @@ var curCache; | ||
self.mget = function(keys, cb){ | ||
if(arguments.length < 2){ | ||
throw new exception('INCORRECT_ARGUMENT_EXCEPTION', '.mget() requires 2 arguments.'); | ||
} | ||
self.log(false, 'MGetting keys:', {keys: keys}); | ||
@@ -94,2 +100,5 @@ var maxKeysFound = 0; | ||
self.set = function(key, value, expiration, cb){ | ||
if(arguments.length < 2){ | ||
throw new exception('INCORRECT_ARGUMENT_EXCEPTION', '.set() requires a minimum of 2 arguments.'); | ||
} | ||
for(var i = 0; i < self.cacheCollection.preApi.length; i++){ | ||
@@ -117,13 +126,13 @@ var cache = self.cacheCollection.preApi[i]; | ||
self.mset = function(){ | ||
var obj; | ||
var expiration; | ||
var cb; | ||
if(arguments.length < 1){ | ||
throw new exception('INCORRECT_ARGUMENT_EXCEPTION', '.mset() requires a minimum of 1 argument.'); | ||
} | ||
var obj = arguments[0]; | ||
var expiration = null; | ||
var cb = null; | ||
if(arguments.length === 3){ | ||
obj = arguments[0]; | ||
expiration = arguments[1] || null; | ||
expiration = arguments[1]; | ||
cb = arguments[2]; | ||
} | ||
else if(arguments.length === 2){ | ||
obj = arguments[0]; | ||
expiration = null; | ||
cb = arguments[1]; | ||
@@ -154,2 +163,5 @@ } | ||
self.del = function(keys, cb){ | ||
if(arguments.length < 1){ | ||
throw new exception('INCORRECT_ARGUMENT_EXCEPTION', '.del() requires a minimum of 1 argument.'); | ||
} | ||
for(var i = 0; i < self.cacheCollection.preApi.length; i++){ | ||
@@ -218,3 +230,2 @@ var cache = self.cacheCollection.preApi[i]; | ||
} | ||
//console.log('LOG', !isPostApi) | ||
if(!isPostApi){ | ||
@@ -221,0 +232,0 @@ var curCache = self.cacheCollection.preApi[cacheIndex]; |
{ | ||
"name": "cache-service", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "A tiered caching solution for node.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
40050
913