package
Tiny FILO cache for Client or Server
npm install tiny-filoGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
6.9 kB
Includes dependencies.
Removes item from cache
param {String} key Item key
return {Object} FILO instanceExample
cache.delete("myKey");Evicts the last item from cache
return {Object} FILO 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 = filo(500);
cache.max; // 500Sets item in cache
param {String} key Item key
param {Mixed} value Item value
return {Object} FILO instanceExample
cache.set("myKey", {prop: true});Number of items in cache
Example
const cache = filo();
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 = filo();
cache.ttl = 3e4;Copyright (c) 2019 Jason Mulligan Licensed under the BSD-3 license.