2.0.7 • Published 3 years ago

@lindeneg/ls-cache v2.0.7

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

@lindeneg/ls-cache

typescript bundle-size license


Utility class for interacting with localStorage

Installation

yarn add @lindeneg/ls-cache

Usage

import LSCache from '@lindeneg/ls-cache';

// default usage
const cache = new LSCache();

// async usage
const cache = new LSCache({
  delayInit: true,
});

await cache.initialize();

Config

type Config = {
  /* prefix localStorage keys to avoid collisions
     default: '__cl_ls_cache__' */
  prefix?: string;

  /* delay localStorage initialization
     default: false */
  delayInit?: boolean;

  /* trimming interval in seconds 
     default: 600 */
  trim?: number;

  /* time-to-live in seconds 
     default: 3600 */
  ttl?: number;
};

Methods

The documentation here can be used.

2.0.7

3 years ago

2.0.6

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago