npm.io
1.0.7 • Published 4 years ago

twt_utils

Licence
ISC
Version
1.0.7
Deps
1
Size
20 kB
Vulns
0
Weekly
0

twt_utils 是个工具库(目前只有本地缓存功能,后续继续维护增加~~)

安装

npm i twt_utils
或
yarn install twt_utils
使用
// 未加密缓存
import { Cache } from 'twt_utils'

// key 存储键值; value stgring类型值; isLocal 默认为true使用local存储,否则使用session
Cache.setCache(key, value, isLocal);

// key 存储键值; isLocal 默认为true使用local存储,否则使用session
Cache.getCache(key, isLocal) // 获取某值

// key 存储键值; isLocal 默认为true使用local存储,否则使用session
Cache.deleteCache(key, isLocal) // 删除某值

// 清理所有缓存
Cache.clearCache()



// 使用加密方案

import { EncryptedCache } from 'twt_utils'

// key 加密密文
const Cache = new EncryptedCache(key: string)

// 使用与上方类似 只是对存储数据进行加密验证