()
| 18 | * If Redis is configured but fails, operations will fail (not fallback to DB). |
| 19 | */ |
| 20 | export function getStorageMethod(): StorageMethod { |
| 21 | if (cachedStorageMethod) { |
| 22 | return cachedStorageMethod |
| 23 | } |
| 24 | |
| 25 | const redis = getRedisClient() |
| 26 | |
| 27 | if (redis) { |
| 28 | cachedStorageMethod = 'redis' |
| 29 | logger.info('Storage method: Redis') |
| 30 | } else { |
| 31 | cachedStorageMethod = 'database' |
| 32 | logger.info('Storage method: PostgreSQL') |
| 33 | } |
| 34 | |
| 35 | return cachedStorageMethod |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Check if Redis is the configured storage method. |
no test coverage detected