2.0.7 • Published 2 years ago

@lindeneg/ls-cache v2.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago