Commit 1f4da4de authored by liaozan's avatar liaozan 🏀

Add keys operation

parent 257d661d
......@@ -162,10 +162,7 @@ public class CacheUtils {
}
/**
* keys
*
* @param pattern
* @return
* 模糊搜索 key
*/
public static Set<String> keys(String pattern) {
return getCacheProvider().keys(pattern);
......
......@@ -13,7 +13,6 @@ import org.springframework.core.env.Environment;
import java.time.Duration;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
/**
* @author liaozan
......@@ -66,12 +65,7 @@ public class CacheProviderDelegate implements CacheProvider {
@Override
public Set<String> keys(String pattern) {
Set<String> keys = getCacheProvider().keys(withKeyPrefix(pattern));
return keys.stream().map(e->{
if(StringUtils.isBlank(prefixWithDelimiter)){
return e;
}
return e.replaceFirst(prefixWithDelimiter,"");
}).collect(Collectors.toSet());
return StreamUtils.toSet(keys, this::removeKeyPrefix);
}
@Override
......
......@@ -71,10 +71,7 @@ public class RedisCacheProvider implements CacheProvider {
}
/**
* 模糊搜索KEY
*
* @param pattern
* @return
* 模糊搜索 key
*/
@Override
public Set<String> keys(String pattern) {
......
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