Storing data in key-value structure to multiple different storages.
- Easy to use API
- Support for Node.js, Bun and the browser
- Support for multiple storage types (memory, file, local storage, etc.)
- Support for time-based expiration
npm install @litehex/storage-box
import { Client } from '@litehex/storage-box';
const client = new Client();
client.setex('key', 'value', 2);
console.log(client.get('key')); // value
// time to live in milliseconds
console.log(client.ttl('key', true)); // 2000
// after 3 seconds
setTimeout(() => {
console.log(client.get('key')); // undefined
}, 3e3);
For all configuration options, please see the API docs.
You can contribute to this project by opening an issue or a pull request on GitHub. Feel free to contribute, we care about your ideas and suggestions.