% bun i @warsam-e/stashimport { Stash } from '@warsam-e/stash';
const stash = new Stash("example-key"); // default driver -> InMemoryDriver
async function orig_data() { ... }
const data = () => 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- InMemoryDriver: The default driver, stores data in memory.
- RedisDriver: Stores data in a Redis database.
- SqliteDriver: Stores data in a SQLite file.