File size: 409 Bytes
c09f67c
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import { RedisCache } from "./redis-client";

// Redis-based cache for users shared across all server instances
const cache = new RedisCache("user", 30 * 60); // 30 minutes TTL

export const userCache = {
  get: (key: string): Promise<any | undefined> => cache.get(key),
  set: (key: string, value: any): Promise<void> => cache.set(key, value),
  delete: (key: string): Promise<void> => cache.delete(key),
};