UNPKG

ghost-cache

Version:

A lightweight auto-caching wrapper for fetch() and Axios with multi-storage support (localStorage, sessionStorage, IndexedDB, Redis)

18 lines (17 loc) 388 B
export class InMemoryStorageAdapter { constructor() { this.store = new Map(); } async getItem(key) { return this.store.has(key) ? this.store.get(key) : null; } async setItem(key, value) { this.store.set(key, value); } async removeItem(key) { this.store.delete(key); } async clear() { this.store.clear(); } }