From 1653372d3ea6f28c781e5b340c54412ac2db22b9 Mon Sep 17 00:00:00 2001 From: LamGC Date: Mon, 30 Mar 2020 12:31:31 +0800 Subject: [PATCH] =?UTF-8?q?[Change]=20=E5=A2=9E=E5=8A=A0=E5=AF=B9=E6=97=A0?= =?UTF-8?q?=E5=89=8D=E7=BC=80=E6=83=85=E5=86=B5=E4=B8=8B=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/net/lamgc/cgj/cache/RedisCacheStore.java | 6 +++++- src/main/java/net/lamgc/cgj/cache/RedisPoolCacheStore.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/lamgc/cgj/cache/RedisCacheStore.java b/src/main/java/net/lamgc/cgj/cache/RedisCacheStore.java index ac54527..dfd45f3 100644 --- a/src/main/java/net/lamgc/cgj/cache/RedisCacheStore.java +++ b/src/main/java/net/lamgc/cgj/cache/RedisCacheStore.java @@ -32,7 +32,11 @@ public abstract class RedisCacheStore implements CacheStore { if(password != null) { this.jedis.auth(password); } - keyPrefix = prefix.endsWith(".") ? prefix : prefix + "."; + if(prefix != null) { + keyPrefix = prefix.endsWith(".") ? prefix : prefix + "."; + } else { + keyPrefix = ""; + } } public void connect() { diff --git a/src/main/java/net/lamgc/cgj/cache/RedisPoolCacheStore.java b/src/main/java/net/lamgc/cgj/cache/RedisPoolCacheStore.java index bde0715..131e208 100644 --- a/src/main/java/net/lamgc/cgj/cache/RedisPoolCacheStore.java +++ b/src/main/java/net/lamgc/cgj/cache/RedisPoolCacheStore.java @@ -23,7 +23,11 @@ public abstract class RedisPoolCacheStore implements CacheStore { redisServerUri.getPort() <= 0 ? 6379 : redisServerUri.getPort(), timeout <= 0 ? Protocol.DEFAULT_TIMEOUT : timeout, password); log = LoggerFactory.getLogger("RedisPoolCacheStore@" + Integer.toHexString(jedisPool.hashCode())); - this.keyPrefix = prefix.endsWith(".") ? prefix : prefix + "."; + if(prefix != null) { + keyPrefix = prefix.endsWith(".") ? prefix : prefix + "."; + } else { + keyPrefix = ""; + } } @Override