Cache Entity
Cache remote resources in a key-value store
Install
npm install cache-entity
Usage
import CacheEntity from 'cache-entity'
const cache = new CacheEntity({
users: 'https://jsonplaceholder.typicode.com/users/{key}',
todos: 'https://jsonplaceholder.typicode.com/todos/{key}',
})
cache.add('todos', { 1: { name: 'Buy apples' }, 2: { name: 'Fix bugs' } })
const todo1 = await cache.lookup('todos', 1)
const todo2 = await cache.lookup('todos', 3)
const todo3 = await cache.lookup('todos', 3)
Changelog
License
ISC License