You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple and flexible caching library for TypeScript
Installation
% bun i @warsam-e/stash
Usage
import{Stash}from'@warsam-e/stash';conststash=newStash("example-key");// default driver -> InMemoryDriverasyncfunctionorig_data(){ ... }constdata=()=>stash.wrap("item-key","1 hour later",()=>orig_data())data().then(console.log);// after the first, any calls to the same key (with the matching duration)// will return the cached value
Drivers
InMemoryDriver: The default driver, stores data in memory.
RedisDriver: Stores data in a Redis database.
SqliteDriver: Stores data in a SQLite file.
About
A simple and flexible caching library for JavaScript and TypeScript