This commit is contained in:
2026-01-25 13:42:28 +01:00
parent 4dbf566f0c
commit c074a5d935
13 changed files with 383 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import { createClient, type RedisClientType } from 'redis';
import type { CacheService, CacheSetOptions } from './cache-service';
import { getServerAppServices } from '../create-services.server';
export type RedisCacheServiceOptions = {
url: string;
@@ -17,7 +18,12 @@ export class RedisCacheService implements CacheService {
this.keyPrefix = options.keyPrefix ?? '';
// Fire-and-forget connect.
this.client.connect().catch(() => undefined);
this.client.connect().catch((err) => {
// We can't use getServerAppServices() here because it might cause a circular dependency
// during initialization. But we can log to console as a fallback or use a global logger if we had one.
// For now, let's just use console.error as this is a low-level service.
console.error('Redis connection error:', err);
});
}
private k(key: string) {