完成模块2
This commit was merged in pull request #14.
This commit is contained in:
+8
@@ -69,4 +69,12 @@ public class RedisUtil {
|
||||
public Mono<Boolean> expire(String key, long timeoutSeconds) {
|
||||
return reactiveRedisTemplate.expire(key, Duration.ofSeconds(timeoutSeconds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通配符模式删除key
|
||||
*/
|
||||
public Mono<Long> deleteByPattern(String pattern) {
|
||||
return reactiveRedisTemplate.keys(pattern)
|
||||
.flatMap(keys -> reactiveRedisTemplate.delete(keys)).count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user