diff --git a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/local/CacheUtil.java b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/local/CacheUtil.java index a704054..d7e17ed 100644 --- a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/local/CacheUtil.java +++ b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/local/CacheUtil.java @@ -60,8 +60,8 @@ import static org.opsli.common.constants.OrderConstants.UTIL_ORDER; @Component public class CacheUtil { - /** 热点数据缓存时间 秒 */ - private static int TTL_HOT_DATA_TIME = 60000; + /** 热点数据缓存时间 秒 (6小时)*/ + private static int TTL_HOT_DATA_TIME = 21600; /** 空缓存时间 秒 */ private final static int TTL_NIL_DATA_TIME = 300; /** Redis插件 */ @@ -306,7 +306,7 @@ public class CacheUtil { } // 如果本地缓存找不到该缓存 则去远端缓存拉去缓存 - cacheJson = (JSONObject) redisPlugin.hGet(key, field); + cacheJson = (JSONObject) redisPlugin.hGet(cacheKey, field); if(cacheJson != null){ // 判读是否需要 存入本地EhCache if(isSaveLocal){ @@ -616,7 +616,7 @@ public class CacheUtil { Node ttlNode = expiryNodes.item(k); Node ttlValue = ttlNode.getFirstChild(); // 默认 60000秒 6小时 - TTL_HOT_DATA_TIME = Convert.toInt(ttlValue.getNodeValue(), 60000); + TTL_HOT_DATA_TIME = Convert.toInt(ttlValue.getNodeValue(), 21600); break; } } diff --git a/opsli-plugins/opsli-plugins-redis/src/main/java/org/opsli/plugins/redis/RedisPlugin.java b/opsli-plugins/opsli-plugins-redis/src/main/java/org/opsli/plugins/redis/RedisPlugin.java index 4d76e7f..fe2433a 100644 --- a/opsli-plugins/opsli-plugins-redis/src/main/java/org/opsli/plugins/redis/RedisPlugin.java +++ b/opsli-plugins/opsli-plugins-redis/src/main/java/org/opsli/plugins/redis/RedisPlugin.java @@ -924,6 +924,21 @@ public class RedisPlugin { return redisTemplate.opsForSet().add(key, values); } + /** + * set添加元素 + * + * @param key + * @param values + * @return + */ + public Long sPutAll(String key, Collection values) { + Object[] objects = {}; + if(values != null){ + objects = values.toArray(); + } + return redisTemplate.opsForSet().add(key, objects); + } + /** * set移除元素 * @@ -942,8 +957,12 @@ public class RedisPlugin { * @param values * @return */ - public Long sRemove(String key, Collection values) { - return redisTemplate.opsForSet().remove(key, values); + public Long sRemoveList(String key, Collection values) { + Object[] objects = {}; + if(values != null){ + objects = values.toArray(); + } + return redisTemplate.opsForSet().remove(key, objects); } diff --git a/opsli-starter/src/main/resources/config/ehcache-opsli.xml b/opsli-starter/src/main/resources/config/ehcache-opsli.xml index 9b11b5d..f288899 100644 --- a/opsli-starter/src/main/resources/config/ehcache-opsli.xml +++ b/opsli-starter/src/main/resources/config/ehcache-opsli.xml @@ -23,8 +23,8 @@ - - 60000 + + 21600