fix(core): Handle Redis cache prefix on cluster mode (#17957)

This commit is contained in:
Amsal Khan
2025-08-11 14:34:28 +05:30
committed by GitHub
parent 2f5f6d4d68
commit f4a04132d9

View File

@@ -40,9 +40,12 @@ export class CacheService extends TypedEmitter<CacheEvents> {
const redisClientService = Container.get(RedisClientService);
const prefixBase = this.globalConfig.redis.prefix;
const prefix = redisClientService.toValidPrefix(
`${prefixBase}:${this.globalConfig.cache.redis.prefix}:`,
);
const cachePrefix = this.globalConfig.cache.redis.prefix;
// For cluster mode, we need to ensure proper hash tagging: {n8n:cache}:
// instead of {n8n:cache:} to keep the colon outside the hash tag
const hashTagPart = `${prefixBase}:${cachePrefix}`;
const prefix = redisClientService.toValidPrefix(hashTagPart) + ':';
const redisClient = redisClientService.createClient({
type: 'cache(n8n)',