Skip to content

mdevils/fast-memory-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fast-memory-cache Build Status

Simple in-memory cache implementation for Node.js

Installation

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
cache.delete('key');
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

About

Simple in-memory cache implementation

Resources

Stars

Watchers

Forks

Packages

No packages published