wecache
v1.0.0
Published
cache for wechat mini program
Downloads
15
Maintainers
Readme
wecache
local cache library for wechat mini program (using storage) 微信小程序缓存库(使用storage)
Install
$ npm i -S wecache
Usage
const wecache = require('wecache')
wecache.set('foo', 'bar')
wecache.get('foo') // bar
Api
.set(key, value, [expire])
Add an item to the cache
key
Type: number
or string
(except "")
value
Type: any
expire
Type: number
(milliseconds from now to expire) or date
(the expire date). if set a number, number should not greater than 1000 * 24 * 3600 * 1000
(milliseconds of one thousands days)
Default: 1 * 24 * 3600 * 1000
(milliseconds of one day)
.get(key)
Retrieve item from the storage
key
Type: number
or string
(except "")
.incr(key)
Increment item's value
key
Type: number
or string
(except "")
.decr(key)
Decrement item's value
key
Type: number
or string
(except "")
.remove(key)
Delete item from the storage
key
Type: number
or string
(except "")
.clear()
Delete all existing items from the storage
.all()
Get all caches
License
MIT © klouskingsley