package
Tiny FIFO cache for Client or Server
npm install tiny-fifoGitHub-flavored package documentation.
Across all versions, last 30 days.
63 in 30 days
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
6.8 kB
Includes dependencies.
Removes item from cache
param {String} key Item key
return {Object} FIFO instanceExample
cache.delete("myKey");Evicts the first item from cache
return {Object} FIFO instanceExample
cache.evict();Gets item in cache
param {String} key Item key
return {Mixed} Undefined or Item valueExample
const item = cache.get("myKey");Returns an Array of cache item keys
return {Array} Array of keysExample
console.log(cache.keys());Max items to hold in cache (1000)
Example
const cache = fifo(500);
cache.max; // 500Sets item in cache
param {String} key Item key
param {Mixed} value Item value
return {Object} FIFO instanceExample
cache.set("myKey", {prop: true});Number of items in cache
Example
const cache = fifo();
cache.size; // 0 - it's a new cache!Milliseconds an item will remain in cache; lazy expiration upon next get() of an item
Example
const cache = fifo();
cache.ttl = 3e4;Copyright (c) 2019 Jason Mulligan Licensed under the BSD-3 license.