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