1.0.18 • Published 2 months ago

@budarin/cache-store v1.0.18

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

cache-store

Service for storing json data in the browser cache.

The service is a simple alternative to IndexedDB, but without an overhead for the description of the structure and the ceremonies for updating and changing structure.

This storage is convenient both for direct storage of unstructured data in the form of JSON and as a common data storage shared by the client and the service worker.

Instalation

yarn add @budarin/cache-store

Usage

import { CacheStore } from '@budarin/cache-store';

const store = new CacheStore('kv-storage'); //ew CacheStore('kv-storage', console);
const usersStore = [
    {
        name: 'Ivan',
        age: 20,
    },
    {
        name: 'Petr',
        age: 21,
    },
];

await store.setItem('users', usersStore);

const users = await store.getItem('users');
users.forEach((user) => console.log(user));

await store.removeItem('users');
await store.clear('kv-storage');
1.0.18

2 months ago

1.0.17

2 months ago

1.0.16

2 months ago

1.0.15

3 months ago

1.0.14

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.11

5 months ago

1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago