@tni/cache
v1.0.6
Published
localStorage, sessionStorage封装
Downloads
4
Readme
安装
# npm
npm install @tni/cache
# yarn
yarn add @tni/cache
# pnpm
pnpm add @tni/cache
使用
import { createLocalStorage, createSessionStorage, createStorage, WebStorage } from '@tni/cache'
const local = createLocalStorage()
const session = createSessionStorage()
local.set(key, value, expire)
local.get(key, defaultValue)
local.remove(key)
local.clear()
session.set(key, value, expire)
session.get(key, defaultValue? = null)
session.remove(key)
session.clear()