Commit 03d19da1 authored by wangwei's avatar wangwei

expireAt 方法

parent 483205e1
...@@ -225,7 +225,7 @@ public class RedisBloomHandler<K, V> { ...@@ -225,7 +225,7 @@ public class RedisBloomHandler<K, V> {
* @return * @return
*/ */
public Integer saveBloom(String key, String value, Integer levelCount) { public Integer saveBloom(String key, String value, Integer levelCount) {
String luaText = "local a = "+(levelCount+1)+"\n" + String luaText = "local a = " + (levelCount + 1) + "\n" +
"for i = 1, #(ARGV)+1 do\n" + "for i = 1, #(ARGV)+1 do\n" +
" if(redis.call('BF.ADD', KEYS[1], (ARGV[1] .. '_' .. i)) == 1) then\n" + " if(redis.call('BF.ADD', KEYS[1], (ARGV[1] .. '_' .. i)) == 1) then\n" +
" a = i;\n" + " a = i;\n" +
...@@ -264,7 +264,7 @@ public class RedisBloomHandler<K, V> { ...@@ -264,7 +264,7 @@ public class RedisBloomHandler<K, V> {
}, true); }, true);
} }
public void createFiltersWithExpireAt(RedisTemplate redisTemplate,List<K> keys, double errorRate, long initCapacity, long expireAt) { public void createFiltersWithExpireAt(RedisTemplate redisTemplate, List<K> keys, double errorRate, long initCapacity, long expireAt) {
byte[] rawErrorRate = rawString(String.valueOf(errorRate)); byte[] rawErrorRate = rawString(String.valueOf(errorRate));
byte[] rawInitCapacity = rawString(String.valueOf(initCapacity)); byte[] rawInitCapacity = rawString(String.valueOf(initCapacity));
Object execute = redisTemplate.execute(connection -> { Object execute = redisTemplate.execute(connection -> {
...@@ -287,6 +287,10 @@ public class RedisBloomHandler<K, V> { ...@@ -287,6 +287,10 @@ public class RedisBloomHandler<K, V> {
return redisTemplate.getExpire(key); return redisTemplate.getExpire(key);
} }
public Long getExpire(RedisTemplate redisTemplate, String key) {
return redisTemplate.getExpire(key);
}
/** /**
* 设置redis过去时间 * 设置redis过去时间
* *
...@@ -297,4 +301,8 @@ public class RedisBloomHandler<K, V> { ...@@ -297,4 +301,8 @@ public class RedisBloomHandler<K, V> {
public Boolean expireAt(String key, Date delta) { public Boolean expireAt(String key, Date delta) {
return redisTemplate.expireAt(key, delta); return redisTemplate.expireAt(key, delta);
} }
public Boolean expireAt(RedisTemplate redisTemplate, String key, Date date) {
return redisTemplate.expireAt(key, date);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment