Nano-memo
450 bytes minified/gzipped. 1kb uncompressed/unminified.
Nano-memo is a simple key/value memory store that supports namespaces. It probably doesn't get any simpler than this (unless you take out stores). Nano-memo also keeps track of "hits" or the number of times the memoizer was utilized so that you can track metrics.
Usage
npm install nano-memo
const cache = cache // Registers a namespace (like a section or area to store values, separate from others) var myResource = foo: '1' bar: 2 // You can use arrays, objects, strings, numbers, any valid JavaScript variable. cache // Memoize myResource with the key 1 (the key can be a value or string or anything valid for JavaScript keys) var retrievedResource = cache // Returns myResource from the store. var letMeSeeASpace = cachedata'resources' // Returns the memoization structure for a single namespace cache // Invalidate the key containing myResourcecache // Invalidate the entire resources store.cache // Invalidate all stores (clear everything) var letMeSeeEverything = cachedata // Returns the entire memoization structure (so you can save it to disk/debug/etc.