This commit is contained in:
guohb
2024-06-04 16:28:08 +08:00
parent 148ce575e8
commit d114275c7e
6 changed files with 20 additions and 7 deletions

View File

@@ -25,8 +25,8 @@ public class CommonConstants {
public static final int NORMAL_LOCK_TIMES = 60 * 1000;
public static final int AN_HOUR_SECONDS = 3600;
public static final int TEN_SECONDS = 10;
//十秒
public static final int TEN_SECONDS = 10000;
/**
* 跟进任务通知缓存时间 1小时

View File

@@ -321,6 +321,16 @@ public class RedisUtilPool {
public boolean setNxExpire(final String key, final String value, final int expire) {
String res = new Executor<String>(shardedJedisPool) {
@Override
/**
* 参数定义详解,避免用错:
* set(String key, String value, String nxxx, String expx, int time)
* @key key
* @value value
* @nxxx 1.nx not exists, 只有key 不存在时才把key value set 到redis
* 2.xx is exists ,只有 key 存在是才把key value set 到redis
* @expx 1.ex seconds 秒; 2.px : milliseconds 毫秒
* 我们当前选用的是 nx,px,即key不存在时才set且过期时间为毫秒
*/
String execute() {
return jedis.set(key, value, SET_IF_NOT_EXIST, SET_WITH_EXPIRE_TIME, expire);
}