kash
What?
Fast and simple in-memory caching.
Why?
Because sometimes you need straight-forward, reliable, and low-latency caching.
Installation
npm install kash
And then import it:
// using es modules// common.jsconst kash = default// AMD// I've forgotten but it should work.
Or use script tags and globals.
And then grab it off the global like so:
const kash = kashdefault
Synopsis
;kash;console;
Will print the following in the console:
barnull
API
kash.set(key, value [, expires ])
Set a key
with a value
. Set expires
to remove from cache after specified number of milliseconds. Defaults to 2000
ms.
kash.get(key)
Retrieve the value
for the specified key
. Returns null
if key
does not exist.
kash.del(key)
Deletes a key
.
kash.flush()
Removes the cache of all contents.
kash.size()
Get the number of entries in the cache.
Author
Matthew Hudson |