short-storage - Simple in-memory caching
Simple to use
var cache = ; var ttl = 1000; // 0 - infinite time to live (by default)cache; console; // 'hello'
About
Simple (in-memory) storage types to store keys or values with a time to live (that expire and become null).
Installation
from npm
npm install short-storage
from source
git clone https://github.com/talmobi/short-storage
cd short-storage
npm install
API
/** * Creates a new storage object * @param * @param * @param * @returns */ /** * Gets the value for the specified key * @param * @returns */ /** * @param * @param * @param */ /** * Creates a new tube storage object * @param * @param * @param * @returns */ /** * pull all values from the tube, ordered by FILO (First In, Last Out) * @param * @returns {Array) - Array of most recent inserted valid (ttl not expired) values */ /** * push a new value into the tube * @param * @param */
Test
npm test // node_modules/.bin/mocha test/*
LICENSE
MIT