Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including fast-memory-cache with all npm packages installed. Try it out:

var fastMemoryCache = require("fast-memory-cache")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

fast-memory-cache v2.0.4

Simple in-memory cache implementation

fast-memory-cache Build Status

Simple in-memory cache implementation for Node.js


npm install --save fast-memory-cache

Usage example

var MemoryCache = require('fast-memory-cache');

// Create cache
var cache = new MemoryCache();

// Get/set value
var val = cache.get('key'); // undefined
cache.set('key', 'value');
val = cache.get('key'); // 'value'

// Delete value
val = cache.get('key'); // undefined

// Set value which will expire after 1 second
cache.set('key', 'new-value', 1);
setTimeout(function () {
    val = cache.get('key'); // undefined
}, 2000);

Running tests

npm install
npm test


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free