kasuken / indexeddb-cache

IndexedDB Caching Solution

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexedDB Caching Solution

Cache solution which makes use of IndexedDB storage in the browser to avoid reaching the size limits of localStorage and sessionStorage.

Installation

npm i @estruyf/icache

Usage in your solution

In your solution, you can use it as follows:

import { CacheService, DateHelper, DateInterval } from '@estruyf/icache';

const cache = new CacheService(`EventCache`);
await cache.init();

// Write data to the cache
await cache.put(`YourCacheKey`, <data>, DateHelper.dateAdd(Date(), DateInterval.minute, 1));

// Read data from the cache
const eventData = await cache.get(`YourCacheKey`);

Changelog

Check it out here: changelog

Feedback

If you have feedback or issues, feel free to report them on the issue list of this project: estruyf/indexeddb-cache.

About

IndexedDB Caching Solution

License:MIT License


Languages

Language:TypeScript 95.2%Language:JavaScript 4.8%