diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java
index 7489828..e2a4ed7 100644
--- a/src/main/java/com/nis/util/Constants.java
+++ b/src/main/java/com/nis/util/Constants.java
@@ -219,9 +219,13 @@ public final class Constants {
/**
- * redis分布式锁超时时间,默认五分钟,3000秒
+ * redis分布式锁超时时间,默认五分钟,300秒
*/
- public static final Long REDISLOCKTIME=Configurations.getLongProperty("redisLockTime", 3000);
+ public static final Long REDISLOCKTIME=Configurations.getLongProperty("redisLockTime", 300);
+ /**
+ * 全量数据同步分布式锁时间,默认两个小时
+ */
+ public static final Long CONFIGSYNCLOCKTIME=Configurations.getLongProperty("configSyncLockTime", 7200);
/**
* 获取redis分布式锁失败后的尝试获取锁的次数,每次失败暂停一秒钟后再次尝试
*/
diff --git a/src/main/java/com/nis/util/JedisClusterUtils.java b/src/main/java/com/nis/util/JedisClusterUtils.java
new file mode 100644
index 0000000..e5d1044
--- /dev/null
+++ b/src/main/java/com/nis/util/JedisClusterUtils.java
@@ -0,0 +1,361 @@
+package com.nis.util;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Lists;
+import com.nis.restful.RestBusinessCode;
+import com.nis.restful.ServiceRuntimeException;
+import com.nis.web.service.SpringContextHolder;
+
+import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.exceptions.JedisException;
+
+/**
+ * @ClassName: JedisClusterUtils
+ * @Description: redis-cluster库工具类
+ * @author (rkg)
+ * @date 2018年12月01日 上午10:31:00
+ * @version V1.0
+ */
+public class JedisClusterUtils {
+ private static Logger logger = LoggerFactory.getLogger(JedisClusterUtils.class);
+
+ /**
+ * 获取缓存
+ *
+ * @param key 键
+ * @return 值
+ */
+ public static String get(String key) {
+ String value = null;
+ JedisCluster jedis = null;
+ try {
+ jedis = getResource();
+ if (jedis.exists(key)) {
+ value = jedis.get(key);
+ value = StringUtils.isNotBlank(value) && !"nil".equalsIgnoreCase(value) ? value : null;
+ logger.debug("get {} = {}", key, value);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException("从redis-cluster中获取" + key + "对应的值失败",
+ RestBusinessCode.KeyNotExistsInRedis.getValue());
+ } finally {
+ returnResource(jedis);
+ }
+ return value;
+ }
+
+ /**
+ * 获取缓存
+ *
+ * @param key 键
+ * @return 值
+ */
+ public static Object getObject(String key) {
+ Object value = null;
+ JedisCluster jedis = null;
+ try {
+ jedis = getResource();
+ if (jedis.exists(getBytesKey(key))) {
+ value = toObject(jedis.get(getBytesKey(key)));
+ logger.debug("getObject {} = {}", key, value);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException("从redis-cluster中获取" + key + "对应的值失败",
+ RestBusinessCode.KeyNotExistsInRedis.getValue());
+ } finally {
+ returnResource(jedis);
+ }
+ return value;
+ }
+
+ /**
+ * 可以作为获取唯一id的方法
+ * 将key对应的value加上指定的值,只有value可以转为数字时该方法才可用
+ *
+ * @param String key
+ * @param long number 要减去的值
+ * @return long 相加后的值
+ */
+ public static long incrBy(String key, long number) {
+ JedisCluster jedis = getResource();
+ long len = jedis.incrBy(key, number);
+ returnResource(jedis);
+ return len;
+ }
+
+ /**
+ * 设置缓存
+ *
+ * @param key 键
+ * @param value 值
+ * @param cacheSeconds 超时时间,0为不超时
+ * @return
+ */
+ public static String set(String key, String value, int cacheSeconds) {
+ String result = null;
+ JedisCluster jedis = null;
+ try {
+ jedis = getResource();
+ result = jedis.set(key, value);
+ if (cacheSeconds != 0) {
+ jedis.expire(key, cacheSeconds);
+ }
+ logger.debug("set {} = {}", key, value);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException("向redis-cluster中设置zset失败,key=" + key + ",value=" + value,
+ RestBusinessCode.ZsetFailed.getValue());
+ } finally {
+ returnResource(jedis);
+ }
+ return result;
+ }
+
+ /**
+ * 获取List缓存
+ *
+ * @param key 键
+ * @return 值
+ */
+ public static List getList(String key) {
+ List value = null;
+ JedisCluster jedis = null;
+ try {
+ jedis = getResource();
+ if (jedis.exists(key)) {
+ value = jedis.lrange(key, 0, -1);
+ logger.debug("getList {} = {}", key, value);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException("从redis-cluster中获取" + key + "对应的值失败",
+ RestBusinessCode.KeyNotExistsInRedis.getValue());
+ } finally {
+ returnResource(jedis);
+ }
+ return value;
+ }
+
+ /**
+ * 获取List缓存
+ *
+ * @param key 键
+ * @return 值
+ */
+ public static List