Browse Source

feature1.0.0-img:移除非必要的redisService方法

feature-1.0-img-prototype
chengkun 4 years ago
parent
commit
fb08179727
  1. 18
      bnyer-common/bnyer-common-redis/src/main/java/com/bnyer/common/redis/service/RedisService.java

18
bnyer-common/bnyer-common-redis/src/main/java/com/bnyer/common/redis/service/RedisService.java

@ -310,24 +310,6 @@ public class RedisService
return redisTemplate.opsForHash().increment(key, hashKey,delta); return redisTemplate.opsForHash().increment(key, hashKey,delta);
} }
/**
* 加锁
**/
public Boolean lock(String key,String value,Long duration){
Boolean lockStatus = this.redisTemplate.opsForValue().setIfAbsent(key,value, Duration.ofSeconds(duration));
return lockStatus;
}
/**
* 释放锁
**/
public Long releaseLock(String key,String value){
String luaScript = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
RedisScript<Long> redisScript = new DefaultRedisScript<>(luaScript,Long.class);
Long releaseStatus = (Long)this.redisTemplate.execute(redisScript, Collections.singletonList(key),value);
return releaseStatus;
}
/** /**
* pv统计 * pv统计
* @param today 统计的日期 * @param today 统计的日期

Loading…
Cancel
Save