Skip to content

Commit dab36d8

Browse files
committed
refactor: config redis
1 parent 59e6b0f commit dab36d8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/config/redis.ts renamed to src/config/Rediss.ts

+25
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,39 @@ client.on('error', function (err) {
2525
})
2626

2727
class Redis {
28+
/**
29+
*
30+
* @param key
31+
* @param data
32+
*/
2833
public static set(key: string, data: any[]) {
2934
client.setex(key, 86400, JSON.stringify(data))
3035
}
3136

37+
/**
38+
*
39+
* @param key
40+
* @example
41+
* // get('get-role')
42+
*/
3243
public static get(key: string) {
3344
client.get(key)
3445
}
3546

47+
/**
48+
*
49+
* @param key get all by key return array
50+
* @example
51+
* // keys.('get-role:*')
52+
*/
53+
public static keys(key: string) {
54+
client.keys(key)
55+
}
56+
57+
/**
58+
*
59+
* @param key
60+
*/
3661
public static del(key: string) {
3762
client.del(key)
3863
}

0 commit comments

Comments
 (0)