MCPcopy
hub / github.com/midday-ai/midday / set

Method set

packages/cache/src/redis-client.ts:52–69  ·  view source on GitHub ↗
(key: string, value: unknown, ttlSeconds?: number)

Source from the content-addressed store, hash-verified

50 }
51
52 async set(key: string, value: unknown, ttlSeconds?: number): Promise<void> {
53 try {
54 const serializedValue = this.stringifyValue(value);
55 const redisKey = this.getKey(key);
56 const ttl = ttlSeconds ?? this.defaultTTL;
57
58 if (ttl > 0) {
59 await this.redis.setEx(redisKey, ttl, serializedValue);
60 } else {
61 await this.redis.set(redisKey, serializedValue);
62 }
63 } catch (error) {
64 console.error(
65 `Redis set error for ${this.prefix} cache, key "${key}":`,
66 error,
67 );
68 }
69 }
70
71 async delete(key: string): Promise<void> {
72 try {

Callers 15

api-key-cache.tsFile · 0.80
chat-cache.tsFile · 0.80
team-cache.tsFile · 0.80
user-cache.tsFile · 0.80
setWidgetPreferencesMethod · 0.80
selectTopMetricsFunction · 0.80
detectExpenseAnomaliesFunction · 0.80

Calls 2

stringifyValueMethod · 0.95
getKeyMethod · 0.95

Tested by 2

createMockDatabaseFunction · 0.64
createTestAppFunction · 0.64