wecache

1.0.0 • Public • Published

wecache Build Status

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    13
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    13

Package Sidebar

Install

npm i wecache

Weekly Downloads

13

Version

1.0.0

License

MIT

Unpacked Size

13.7 kB

Total Files

10

Last publish

Collaborators

  • klouskingsley