Skip to content

Commit 4d9b034

Browse files
committed
fix: Add logs to indicate which cache to use
1 parent 3e04684 commit 4d9b034

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/services/in-memory-cache.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
import { createLogger } from "@aklinker1/logger";
12
import { HOUR_MS } from "../utils/time";
23
import type { Cache } from "./cache";
34

5+
const logger = createLogger("redis");
6+
47
const TTL = HOUR_MS;
58

69
export function createInMemoryCache(): Cache {
10+
logger.info("Using in-memory cache");
11+
712
let cache: Record<string, any> = Object.create(null);
813
let ttl: Record<string, number> = Object.create(null);
914

src/services/redis-cache.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
import { createLogger } from "@aklinker1/logger";
12
import { DAY_MS } from "../utils/time";
23
import type { Cache } from "./cache";
34

5+
const logger = createLogger("redis");
6+
47
const TTL = DAY_MS;
58
const TTL_S = TTL / 1000;
69

710
export function createRedisCache(): Cache {
11+
logger.info("Using redis cache", {
12+
url: process.env.REDIS_URL || process.env.VALKEY_URL,
13+
});
14+
815
return {
916
async get<T>(key: string): Promise<T | undefined> {
1017
const value = await Bun.redis.get(key);

0 commit comments

Comments
 (0)