This commit is contained in:
@@ -355,6 +355,13 @@ public final class CacheMemorySource<V extends Object> extends AbstractService i
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hsize(final String key) {
|
||||
CacheEntry entry = container.get(key);
|
||||
if (entry == null || entry.mapValue == null) return 0;
|
||||
return entry.mapValue.keySet().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long hincr(final String key, String field) {
|
||||
return hincr(key, field, 1);
|
||||
@@ -551,6 +558,11 @@ public final class CacheMemorySource<V extends Object> extends AbstractService i
|
||||
return CompletableFuture.supplyAsync(() -> hkeys(key), getExecutor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Integer> hsizeAsync(final String key) {
|
||||
return CompletableFuture.supplyAsync(() -> hsize(key), getExecutor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Long> hincrAsync(final String key, String field) {
|
||||
return CompletableFuture.supplyAsync(() -> hincr(key, field), getExecutor());
|
||||
|
||||
@@ -75,6 +75,8 @@ public interface CacheSource<V extends Object> {
|
||||
|
||||
public List<String> hkeys(final String key);
|
||||
|
||||
public int hsize(final String key);
|
||||
|
||||
public long hincr(final String key, String field);
|
||||
|
||||
public long hincr(final String key, String field, long num);
|
||||
@@ -324,6 +326,8 @@ public interface CacheSource<V extends Object> {
|
||||
|
||||
public CompletableFuture<List<String>> hkeysAsync(final String key);
|
||||
|
||||
public CompletableFuture<Integer> hsizeAsync(final String key);
|
||||
|
||||
public CompletableFuture<Long> hincrAsync(final String key, String field);
|
||||
|
||||
public CompletableFuture<Long> hincrAsync(final String key, String field, long num);
|
||||
|
||||
Reference in New Issue
Block a user