Skip to content

feat: implement sentineled connection for redis cache#3

Open
Nycz-lab wants to merge 3 commits into
developfrom
feature/sentinel-implementation-redis
Open

feat: implement sentineled connection for redis cache#3
Nycz-lab wants to merge 3 commits into
developfrom
feature/sentinel-implementation-redis

Conversation

@Nycz-lab
Copy link
Copy Markdown
Collaborator

@Nycz-lab Nycz-lab commented Apr 2, 2026

No description provided.

@Nycz-lab Nycz-lab requested a review from ByteExceptionM April 2, 2026 12:53
@Nycz-lab Nycz-lab marked this pull request as ready for review April 7, 2026 12:03
Copy link
Copy Markdown
Member

@ByteExceptionM ByteExceptionM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fügt Redis Sentinel Support hinzu. RedisCache wird von JedisPool auf UnifiedJedis umgestellt, ein neuer Sentinel-Konstruktor mit JedisSentineled ergänzt. Neuer CacheType.REDIS_SENTINELED, RedisSentineledCacheSettings und entsprechende Config-Einträge.

Probleme

  • RedisCache.java:32-44 - Im Sentinel-Konstruktor fehlt der Shutdown-Hook (Runtime.getRuntime().addShutdownHook), der im URI-Konstruktor vorhanden ist — JedisSentineled wird beim JVM-Shutdown nie geschlossen (Resource Leak).
  • CacheFactory.java:33-34 - cacheSettings.getUsername() und cacheSettings.getPassword() werden doppelt übergeben — einmal als Master-Credentials und einmal als Sentinel-Credentials. Der RedisCache-Konstruktor nimmt separate sentinelUsername/sentinelPassword entgegen, aber RedisSentineledCacheSettings hat keine eigenen Sentinel-Credential-Felder. Falls Sentinel-Instanzen andere Credentials als der Master haben, ist das ein Logikfehler.
  • RedisSentineledCacheSettings.java:19 - addresses hat keine @NotNull-Annotation — wenn die Liste null ist, wirft sentinelAddresses.stream() in RedisCache eine NullPointerException.
  • CacheSettings.java:31 - sentinel ist @Valid @NotNull und wird damit immer validiert, auch wenn cache != REDIS_SENTINELED ist. Nutzer ohne Sentinel-Config bekommen einen Validierungsfehler beim Start, obwohl sie gar keinen Sentinel-Cache verwenden.

Kleinigkeiten

  • RedisSentineledCacheSettings.java:28 - @NotNull auf dem primitiven boolean ssl ist wirkungslos, da primitive Typen nie null sein können.
  • RedisCache.java:53 - address.lastIndexOf(':') > 0 funktioniert nicht zuverlässig für IPv6-Adressen (z.B. ::1:26379), da diese mehrere Doppelpunkte enthalten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants