1.0.6 • Published 3 years ago
@awey/dache v1.0.6
Dache
Use memory,session storagy or local storage to cache things.
Install
# NPM
npm install @awey/dache --save
# Yarn
yarn add @awey/dacheUseage
import Dache from '@awey/dache'
const dache = new Dache('local', 'myDache')
dache.set('username', 'Tom')
console.log(dache.get('username'))API
new Dache(type: 'memory' | 'session' | 'local', name: string) => Dache: init a Dache instancedache.get(key: string) => any: retrieve a value by key from cachedache.set(key: string, value: any) => void: store a value by key to cachedache.remove(key: string) => void: delete a value by key from cachedache.clear() => void: clear all values in cachedache.has(key: string): determines whether a key exists(not null)dache.is(key: string, value: any): determines whether a value is equal(===) to the specified value