4.0.7 • Published 5 years ago

lim-cache v4.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

lim-cache

Limited Persistent Storage Cache

Installation

yarn add lim-cache

Usage

import { createStorage } from "lim-cache";

const config = {
  limit: 10000
}

const storage = createStorage(config);

Storage object

  • set(key: string, value: any): void Saves value with specific key to cache.
  • get(key: string): any Get value by key.
  • remove(key: string): void Removes value with specific key from cache, returns value.
  • clear(): void Removes all values from cache.

LocalStorage middleware

Local storage middleware allows you to save your cache into browser localStorage.

import { withLocalStorage } from "lim-cache";

const localStorageConfig = {
  name: "myStorage",
  blacklist: ["DoNotPersist"]
}

const storage = createStorage(config, withLocalStorage(localStorageConfig))

Configuring:

  • name: with this name data will be saved into localStorage (usefull if you have more then one storage).
  • blacklist: list of keys that will not be saved to localStorage, but will still be saved to RAM.
4.0.7

5 years ago

4.0.3

5 years ago

4.0.1

5 years ago

2.3.10

6 years ago

2.3.8

6 years ago

2.3.6

6 years ago

2.3.4

6 years ago

2.3.1

6 years ago

2.2.9

6 years ago

2.2.7

6 years ago

2.2.5

6 years ago

2.2.3

6 years ago

2.0.1

6 years ago

1.0.9

6 years ago

1.0.7

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago