JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1239
  • Score
    100M100P100Q107678F
  • License MIT

Simple in-memory cache implementation

Package Exports

  • fast-memory-cache

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-memory-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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