1.1.7 • Published 5 years ago

zd-redis-cache v1.1.7

Weekly downloads
3
License
ISC
Repository
-
Last release
5 years ago

1.安装

npm i zd-redis-cache

2.功能

该模块主要功能包括三部分
1、缓存查询
2、缓存存入
3、缓存更新
说明:该模块内部依赖redis-connection-pool模块连接redis,log4js模块记录日志。

3.使用

2.1 初始化redis连接池对象

const redisPool = require("redis-connection-pool")("myRedisPool", {
    host: "127.0.0.1", 
    port: 6379, 
    max_clients: 10,
    perform_checks: false, 
    database: 0,
    options: 0,
});

2.2 key前缀参数配置

const cfg = {
    projectName: "testProject",
    dbName: "testDb"
};

2.3 创建cache操作对象

const cache = require("zd-redis-cache").getCache(cfg, redisPool);

4.重点函数

  • getQueryKey
getQueryKey(obj)  
  • getUpdateKey
getUpdateKey(tablename)
  • save
save(obj, seconds, result)
  • get
get(obj)
  • post
post(tablename, params)
  • delete
del(tablename, params)
  • put
put(tablename, params)
  • del_procedure
del_procedure(tablname)
1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago