Skip to content

Commit f683721

Browse files
committed
fix: config redis
1 parent c8a27f9 commit f683721

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/config/redis.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ client.on('error', function (err) {
1010
console.log(`Something went wrong ${err}`)
1111
})
1212

13-
export function redisCache(key: string, data: any[]): void {
14-
client.setex(key, 86400, JSON.stringify(data))
15-
}
13+
class Redis {
14+
public static set(key: string, data: any[]) {
15+
client.setex(key, 86400, JSON.stringify(data))
16+
}
17+
18+
public static get(key: string) {
19+
client.get(key)
20+
}
1621

17-
export function redisDeleteCache(key: string) {
18-
client.del(key)
22+
public static del(key: string) {
23+
client.del(key)
24+
}
1925
}
2026

21-
export default client
27+
export default Redis

0 commit comments

Comments
 (0)