redis-lruk
v1.0.3
Published
nodejs redis lruk
Downloads
10
Readme
redis-lruk
缓存算法(基于redis)
安装
npm i redis-lruk
使用
const LRUK = require('redis-lruk');
const config = {
namespace: 'ns',
queue: 3,
cache: 3,
k: 2
};
// 如果client是redis创建的,要调用decorate()方法; async-redis的则不用
const lru2 = new LRUK(client, config);
// 异步函数
lru2.record('word1|word2&word3 word4');
对象成员
- client redis连接
- config lruk配置
- async record(string keywords) 处理复杂的输入再调用hit()
- async hit(string word) 记录单个非空字符串数据
- async top(number n) 查询前n
- async reset(string word) 缓存高频数据