This commit is contained in:
@@ -932,6 +932,22 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
||||
return new ArrayList<>(container.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> queryKeysStartsWith(String startsWith) {
|
||||
if (startsWith == null) return queryKeys();
|
||||
List<String> rs = new ArrayList<>();
|
||||
container.keySet().stream().filter(x -> x.startsWith(startsWith)).forEach(x -> rs.add(x));
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> queryKeysEndsWith(String endsWith) {
|
||||
if (endsWith == null) return queryKeys();
|
||||
List<String> rs = new ArrayList<>();
|
||||
container.keySet().stream().filter(x -> x.endsWith(endsWith)).forEach(x -> rs.add(x));
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getKeySize() {
|
||||
return container.size();
|
||||
@@ -952,6 +968,16 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
||||
return CompletableFuture.completedFuture(new ArrayList<>(container.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<List<String>> queryKeysStartsWithAsync(String startsWith) {
|
||||
return CompletableFuture.completedFuture(queryKeysStartsWith(startsWith));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<List<String>> queryKeysEndsWithAsync(String endsWith) {
|
||||
return CompletableFuture.completedFuture(queryKeysEndsWith(endsWith));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Integer> getKeySizeAsync() {
|
||||
return CompletableFuture.completedFuture(container.size());
|
||||
|
||||
@@ -98,6 +98,10 @@ public interface CacheSource<V extends Object> {
|
||||
|
||||
public List<String> queryKeys();
|
||||
|
||||
public List<String> queryKeysStartsWith(String startsWith);
|
||||
|
||||
public List<String> queryKeysEndsWith(String endsWith);
|
||||
|
||||
public int getKeySize();
|
||||
|
||||
public List<CacheEntry<Object>> queryList();
|
||||
@@ -215,6 +219,10 @@ public interface CacheSource<V extends Object> {
|
||||
|
||||
public CompletableFuture<List<String>> queryKeysAsync();
|
||||
|
||||
public CompletableFuture<List<String>> queryKeysStartsWithAsync(String startsWith);
|
||||
|
||||
public CompletableFuture<List<String>> queryKeysEndsWithAsync(String endsWith);
|
||||
|
||||
public CompletableFuture<Integer> getKeySizeAsync();
|
||||
|
||||
public CompletableFuture<List<CacheEntry< Object>>> queryListAsync();
|
||||
|
||||
Reference in New Issue
Block a user