Changelog - 2026-06-25
Redis Helpers Refactor
Breaking Change New FeatureIn one line. You can now connect through Redis Sentinel and pick a topology from one factory call. Existing Single and Cluster connection behavior is unchanged, but classes are renamed, so imports need updating.
What changed
- Renamed classes and types.
DefaultRedisHelperis nowAbstractRedisHelper,RedisHelperisRedisSingleHelper, andIRedisHelperOptionsisIRedisSingleHelperOptions. No aliases. - New
RedisSentinelHelper. Connects through a Sentinel quorum for automatic failover. - New
createRedisHelper({ mode })factory. PicksRedisModes.SINGLE,CLUSTERorSENTINELfrom config. - New
IRedisHelperinterface. Type consumers against it instead of a concrete class. - Expanded data API. New key operations (
exists,expire,ttl,incr,decr, ...), set operations (sAdd,sMembers, ...), list operations (lPush,rPush,lRange, ...), and hash operationshGet,hDel,hExists,hKeys,hVals,hIncrBy,hLen. set()takesexpiresIn. An optional TTL in milliseconds (RedisPX).
typescript
const redis = createRedisHelper({
mode: RedisModes.SENTINEL,
name: 'cache',
masterName: 'mymaster',
sentinels: [{ host: '10.0.0.1', port: 26379 }],
});Who is affected
- Code importing
RedisHelper,DefaultRedisHelperorIRedisHelperOptions. Update to the new names. - Code calling
mset,mget,hsetorhgetall. Switch to camelCase. - Code reading
.messageoff theerrorin anonErrorcallback. Add a type guard. RedisClusterHelperusers. No action needed.- Socket.IO, WebSocket and BullMQ queue helper users. No action needed.
Breaking changes
WARNING
Public class and type names changed, with no aliases. See the migration guide.
| Before | After |
|---|---|
DefaultRedisHelper | AbstractRedisHelper |
RedisHelper | RedisSingleHelper |
IRedisHelperOptions | IRedisSingleHelperOptions |
mset | mSet |
mget | mGet |
hset | hSet |
hgetall | hGetAll |
The error argument of onError is now unknown instead of any:
typescript
// Before
onError: ({ name, helper, error }) => {
console.error(error.message);
}
// After
onError: ({ name, helper, error }) => {
if (error instanceof Error) {
console.error(error.message);
}
}Type fields against the interface:
typescript
// Before
constructor(private redisConnection: DefaultRedisHelper) {}
// After
import type { IRedisHelper } from '@venizia/ignis-helpers';
constructor(private redisConnection: IRedisHelper) {}Details
RedisSentinelHelpertakesmasterName(the Sentinel group name, separate from the helper'sname),sentinels(port defaults to 26379),role,password,sentinelPassword,autoConnectandredisOptionsfor any other ioredis option. First-class fields win overredisOptions.- Array-input methods (
exists,hDel,sAdd,sRem,lPush,rPush) return0on an empty array without calling ioredis. expireAttakes epoch seconds.set'sexpiresIntakes milliseconds.