From 07ad9d13145b0a2015a90b7e4af0dfa1ca5c7c5d Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Wed, 20 Mar 2024 18:53:39 +0300 Subject: [PATCH] Improvement - RedisURI.hashCode() caching. #5695 --- redisson/src/main/java/org/redisson/misc/RedisURI.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redisson/src/main/java/org/redisson/misc/RedisURI.java b/redisson/src/main/java/org/redisson/misc/RedisURI.java index 8cb031a72..6d8a66bd5 100644 --- a/redisson/src/main/java/org/redisson/misc/RedisURI.java +++ b/redisson/src/main/java/org/redisson/misc/RedisURI.java @@ -34,11 +34,13 @@ public class RedisURI { private final int port; private String username; private String password; + private int hashCode; public RedisURI(String scheme, String host, int port) { this.ssl = "rediss".equals(scheme); this.host = host; this.port = port; + this.hashCode = Objects.hash(ssl, host, port); } public RedisURI(String uri) { @@ -142,7 +144,7 @@ public class RedisURI { @Override public int hashCode() { - return Objects.hash(ssl, host, port); + return hashCode; } @Override