-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
Summary
Extract duplicated precision command fallback logic from RedisTemplate into a reusable utility class with type-safe enum constants.
Current Problem
The same try-catch pattern is duplicated across 3 methods in RedisTemplate:
// This appears in expire(), expireAt(), and getExpire()
try {
return connection.pExpire(rawKey, rawTimeout);
} catch (Exception ignore) {
return connection.expire(rawKey, TimeoutUtils.toSeconds(timeout, unit));
}
------- after -------
Create a utility class PrecisionApiHelper with an enum for type-safe command names:
// New approach - single reusable method
return doWithKeys(connection -> PrecisionApiHelper.withPrecisionFallback(
PrecisionCommand.PEXPIRE,
() -> connection.pExpire(rawKey, rawTimeout),
() -> connection.expire(rawKey, TimeoutUtils.toSeconds(timeout, unit))
));Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged