[Change] 增加对无前缀情况下的处理;

This commit is contained in:
LamGC 2020-03-30 12:31:31 +08:00
parent d4266aaa57
commit 1653372d3e
2 changed files with 10 additions and 2 deletions

View File

@ -32,7 +32,11 @@ public abstract class RedisCacheStore<T> implements CacheStore<T> {
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() {

View File

@ -23,7 +23,11 @@ public abstract class RedisPoolCacheStore<T> implements CacheStore<T> {
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