feat: implement sentineled connection for redis cache#3
Open
Nycz-lab wants to merge 3 commits into
Open
Conversation
Member
ByteExceptionM
left a comment
There was a problem hiding this comment.
Fügt Redis Sentinel Support hinzu.
RedisCachewird vonJedisPoolaufUnifiedJedisumgestellt, ein neuer Sentinel-Konstruktor mitJedisSentineledergänzt. NeuerCacheType.REDIS_SENTINELED,RedisSentineledCacheSettingsund 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 —JedisSentineledwird beim JVM-Shutdown nie geschlossen (Resource Leak). -
CacheFactory.java:33-34-cacheSettings.getUsername()undcacheSettings.getPassword()werden doppelt übergeben — einmal als Master-Credentials und einmal als Sentinel-Credentials. DerRedisCache-Konstruktor nimmt separatesentinelUsername/sentinelPasswordentgegen, aberRedisSentineledCacheSettingshat keine eigenen Sentinel-Credential-Felder. Falls Sentinel-Instanzen andere Credentials als der Master haben, ist das ein Logikfehler. -
RedisSentineledCacheSettings.java:19-addresseshat keine@NotNull-Annotation — wenn die Listenullist, wirftsentinelAddresses.stream()inRedisCacheeineNullPointerException. -
CacheSettings.java:31-sentinelist@Valid @NotNullund wird damit immer validiert, auch wenncache != REDIS_SENTINELEDist. Nutzer ohne Sentinel-Config bekommen einen Validierungsfehler beim Start, obwohl sie gar keinen Sentinel-Cache verwenden.
Kleinigkeiten
-
RedisSentineledCacheSettings.java:28-@NotNullauf dem primitivenboolean sslist wirkungslos, da primitive Typen nienullsein können. -
RedisCache.java:53-address.lastIndexOf(':') > 0funktioniert nicht zuverlässig für IPv6-Adressen (z.B.::1:26379), da diese mehrere Doppelpunkte enthalten.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.