flat-cache
Advanced tools
Comparing version
23
cache.js
@@ -5,2 +5,3 @@ var path = require( 'path' ); | ||
var write = require( 'write' ); | ||
var del = require('del').sync; | ||
@@ -113,3 +114,25 @@ var cache = { | ||
return obj; | ||
}, | ||
/** | ||
* Clear the cache identified by the given id. Caches stored in a different cache directory can be deleted directly | ||
* | ||
* @method clearCache | ||
* @param docId {String} the id of the cache, would also be used as the name of the file cache | ||
* @returns {Boolean} true if the cache folder was deleted. False otherwise | ||
*/ | ||
clearCacheById: function (docId) { | ||
return del(path.resolve( __dirname, './.cache/', docId ), { | ||
force: true | ||
}).length > 0; | ||
}, | ||
/** | ||
* Remove all cache stored in the cache directory | ||
* @method clearAll | ||
* @returns {Boolean} true if the cache folder was deleted. False otherwise | ||
*/ | ||
clearAll: function () { | ||
return del(path.resolve( __dirname, './.cache/'), { | ||
force: true | ||
}).length > 0; | ||
} | ||
}; |
{ | ||
"name": "flat-cache", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A stupidly simple key/value storage using files to persist the data", | ||
@@ -33,3 +33,2 @@ "repository": "royriojas/flat-cache", | ||
"chai": "^2.1.0", | ||
"del": "^1.1.1", | ||
"glob-expand": "0.0.2", | ||
@@ -44,2 +43,3 @@ "istanbul": "^0.3.6", | ||
"dependencies": { | ||
"del": "^1.1.1", | ||
"graceful-fs": "^3.0.5", | ||
@@ -46,0 +46,0 @@ "read-json-sync": "^1.1.0", |
8210
10.74%8
-11.11%125
22.55%4
33.33%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added