import { collectDependencies, hasAnyFile } from '../detection-utils.js';
const VALKEY_DEPS = ['valkey', '@valkey/client', 'iovalkey'];
const REDIS_DEPS = [
    'redis',
    'ioredis',
    '@redis/client',
    'redis-py',
    'aioredis',
    'go-redis',
    'redis-rs',
    'jedis',
    'lettuce-core',
    'predis/predis',
    'ruby-redis',
    'StackExchange.Redis',
];
const MEMCACHED_DEPS = ['memcached', 'memcachier', 'pymemcache', 'gomemcache', 'memcache', 'dalli'];
export async function detectCacheEngine(projectPath) {
    const deps = await collectDependencies(projectPath);
    // Valkey first (Redis fork — more specific)
    if (VALKEY_DEPS.some((d) => deps.has(d))) {
        return 'valkey';
    }
    // Redis
    if (REDIS_DEPS.some((d) => deps.has(d))) {
        return 'redis';
    }
    if (await hasAnyFile(projectPath, ['redis.conf'])) {
        return 'redis';
    }
    // Memcached
    if (MEMCACHED_DEPS.some((d) => deps.has(d))) {
        return 'memcached';
    }
    return null;
}
//# sourceMappingURL=cache-db-detector.js.map