flat-cache
Advanced tools
Comparing version 1.0.1 to 1.0.2
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
8
125
4
+ Addeddel@^1.1.1
+ Addedarray-union@1.0.2(transitive)
+ Addedarray-uniq@1.0.3(transitive)
+ Addedasync@1.5.2(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddel@1.2.1(transitive)
+ Addedeach-async@1.1.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@5.0.157.2.3(transitive)
+ Addedglobby@2.1.0(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-path-cwd@1.0.0(transitive)
+ Addedis-path-in-cwd@1.0.1(transitive)
+ Addedis-path-inside@1.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedobject-assign@3.0.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-is-inside@1.0.2(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedset-immediate-shim@1.0.1(transitive)
+ Addedwrappy@1.0.2(transitive)