1.0.2 • Published 2 years ago

sls-cache v1.0.2

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

SLSC

Small Local Storage Cache

small library to store cache data in localstorage with auto remove (ttl)

using example

import the SLSCache library

import SLSCache from 'sls-cache'

config default values of the TTL and the cache tag name

SLSCache.config({ cacheName: 'slscache', defaultTTL: 10 });
ConfigTypeDefault
cacheNamestringslscache
TTLnumber60 minutes
SLSCache.set('use unique key', 'data of any type', 6);
SLSCache.set('use unique key', 'data of any type without specific TTL');

SLSCache.get('unique key');
supporting typescript
interface Interface {
  val: string;
}

const obj: Interface = { val: 'my value' };
SLSCache.set('obj', obj);

const data = SLSCache.get<Interface>('obj');
console.log(data?.val);
Methodsargs
set(key, data, ttl)
getkey

Source Code In GitHub

1.0.2

2 years ago

1.0.1

2 years ago

0.0.1

2 years ago

1.0.0

2 years ago