gulp-memory-cache
Advanced tools
Comparing version 0.2.0 to 0.3.0
# Changelog | ||
## [0.3.0] - 2015-10-13 | ||
- Add `.flush(cacheName)` method. | ||
## [0.2.0] - 2015-05-13 | ||
- Add file path transformation function `fn` optional argument to `.update()` and `.forget()` | ||
- Add file path transformation function `fn` optional argument to `.update()` and `.forget()`. | ||
@@ -7,0 +11,0 @@ ## [0.1.1] - 2015-05-13 |
@@ -6,2 +6,3 @@ var through = require('through2'); | ||
module.exports.save = saveToCache; | ||
module.exports.flush = flushCache; | ||
module.exports.forget = removeFromCache; | ||
@@ -67,2 +68,8 @@ module.exports.update = updateFromEvent; | ||
function flushCache(cacheName) { | ||
error(!cacheName, 'No cache name to flush was supplied'); | ||
cache[cacheName].flush(); | ||
} | ||
/** | ||
@@ -73,3 +80,3 @@ * Remove file from cache | ||
error(!cacheName, 'No cache name to remove from was supplied'); | ||
error(!filePath, 'No cache name to retrieve was supplied'); | ||
error(!filePath, 'No fileName to remove from cache ' + cacheName + ' was supplied'); | ||
@@ -76,0 +83,0 @@ filePath = fn ? fn(filePath) : filePath; |
@@ -26,2 +26,6 @@ module.exports = Cache; | ||
this.flush = function () { | ||
this.cache = {}; | ||
} | ||
this.remove = function (filePath) { | ||
@@ -28,0 +32,0 @@ if (this.cache[filePath]) { |
{ | ||
"name": "gulp-memory-cache", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A gulp plugin to cache files in memory", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,3 +7,3 @@ [![npm version](https://badge.fury.io/js/gulp-memory-cache.svg)](http://badge.fury.io/js/gulp-memory-cache) | ||
A [gulp](https://github.com/gulpjs/gulp) plugin for caching files in memory to help with incremental building. | ||
A [gulp](https://github.com/gulpjs/gulp) plugin for caching files in memory with incremental build helpers. | ||
@@ -57,3 +57,8 @@ It is aimed to be used with Gulp 4, see why: [Building with Gulp 4: Incremental builds](http://blog.reactandbethankful.com/posts/2015/05/01/building-with-gulp-4-part-4-incremental-builds/). | ||
### cache.flush(name) | ||
- `name` (required): the cache name | ||
Flush (remove all files) cache `name`. Handy to force a stream to process again all its files. | ||
### cache.forget(name, filePath[, fn]) | ||
@@ -60,0 +65,0 @@ |
11381
158
109