Commit 483205e1 authored by wangwei's avatar wangwei

createFiltersWithExpireAt 方法

parent e88c0e5f
...@@ -264,6 +264,19 @@ public class RedisBloomHandler<K, V> { ...@@ -264,6 +264,19 @@ public class RedisBloomHandler<K, V> {
}, true); }, true);
} }
public void createFiltersWithExpireAt(RedisTemplate redisTemplate,List<K> keys, double errorRate, long initCapacity, long expireAt) {
byte[] rawErrorRate = rawString(String.valueOf(errorRate));
byte[] rawInitCapacity = rawString(String.valueOf(initCapacity));
Object execute = redisTemplate.execute(connection -> {
keys.forEach(key -> {
byte[] rawKey = rawKey(key);
connection.execute(RESERVE, rawKey, rawErrorRate, rawInitCapacity);
connection.expireAt(rawKey, expireAt);
});
return null;
}, true);
}
/** /**
* 根据key判断redis key是否设置过期时间 * 根据key判断redis key是否设置过期时间
* *
......
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