1.2.4 • Published 3 years ago

gm-cache v1.2.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

内存缓存器

支持自动过期(并回调)

安装

npm install gm-cache --save

使用

import GmCache from "gm-cache"
const cache = new GmCache()

/**
 * 无过期时间
 */
cache.set("name","ming")

/**
 * 带过期时间
 */
cache.set("name","ming",3000,function(event,value){
    console.log('该数据过期了')
})

/**
 * 取回数据,无数据或已过期,返回 undefined
 */
cache.get("name")

/**
 * 移除缓存,
 */
cache.remove('name')

/**
 * 修改缓存时间
 */
cache.updateExp('name',5000)

/**
 * 修改缓存为永久
 */
cache.updateExp('name',0)
1.2.4

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago