Registry / devops / gulp-memory-cache

gulp-memory-cache

JSON →
library0.3.0jsnpmunverified

A gulp plugin for caching files in memory to enable incremental builds. Version 0.3.0 is the latest stable release, but development appears to be sparse with no recent updates. It provides functions like cache(), cache.save(), cache.flush(), cache.forget(), cache.update(), cache.lastMtime(), and cache.get(). Unlike gulp-cached, this plugin also tracks file modification times and supports custom file path transformations. It is designed for Gulp 4, but can be used with Gulp 3 in combination with gulp-cached.

npm install gulp-memory-cache
INSTALL
IMPORT
SIG · GULP-MEMORY-CACHE
G
gulp-memory-cache
devopsjavascriptv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (cache)
const cache = require('gulp-memory-cache');
import cache from 'gulp-memory-cache';
Package does not ship ESM; CommonJS require is required. Named imports are not supported.
cache()
gulp.src(...).pipe(cache('js'))
gulp.src(...).pipe(cache())
cache() requires a cache name string as first argument.
cache.lastMtime()
gulp.src('**/*.js', {since: cache.lastMtime('js')})
gulp.src('**/*.js', {since: cache.lastMtime()})
lastMtime() requires a cache name argument.

Demonstrates a basic incremental build task with JSHint, caching, concatenation, and a watcher that updates the cache on file changes.

const gulp = require('gulp'); const jshint = require('gulp-jshint'); const concat = require('gulp-concat'); const cache = require('gulp-memory-cache'); gulp.task('buildJs', function () { return gulp.src('src/**/*.js', {since: cache.lastMtime('js')}) .pipe(jshint()) .pipe(cache('js')) .pipe(concat('app.js')) .pipe(gulp.dest('build')); }); gulp.task('watch', function () { gulp.watch('src/**/*.js', gulp.series('buildJs')) .on('change', cache.update('js')); }); gulp.task('build', gulp.series('buildJs', 'watch'));
Debug
Known issues
gotchaThe plugin is designed for Gulp 4. Using with Gulp 3 requires gulp-cached and double caching.
fix
Upgrade to Gulp 4, or combine with gulp-cached.
affects: >=0.1.0
gotchacache() must be called with a name argument; omitting it results in undefined behavior.
fix
Always pass a cache name string.
affects: >=0.1.0
deprecatedThe package has not been updated since 2016; consider using gulp-cached or gulp-changed instead.
fix
Migrate to actively maintained alternatives.
affects: 0.3.0
gotchaFiles are cached in memory; large projects may consume significant RAM.
fix
Monitor memory usage or use disk-based caching for large projects.
affects: >=0.1.0
Errors
Common errors & fixes
SyntaxError: Unexpected token export
Attempting to use ES6 import syntax with a CommonJS package.
fix
Use `const cache = require('gulp-memory-cache');` instead of `import cache from 'gulp-memory-cache';`.
TypeError: cache is not a function
Using the plugin without calling the factory function (e.g., `cache` vs `cache('name')`).
fix
Call `cache('js')` with a cache name string.
gulp.lastRun is not a function
Gulp 4's `lastRun` is not used; the plugin provides `cache.lastMtime` as an alternative.
fix
Use `cache.lastMtime('name')` instead of `gulp.lastRun('task')`.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
gulpoptionalPeer dependency; plugin runs within Gulp pipeline
Agent activity
6 hits · last 30 days
node
6
Resources
gulp-memory-cache — npm install gulp-memory-cache · libregistry