This commit is contained in:
@@ -452,6 +452,14 @@ public final class CacheMemorySource<V extends Object> extends AbstractService i
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> hmap(final String key, final Type type, int offset, int limit) {
|
||||
if (key == null) return new HashMap();
|
||||
CacheEntry entry = container.get(key);
|
||||
if (entry == null || entry.isExpired() || entry.mapValue == null) return new HashMap();
|
||||
return new HashMap(entry.mapValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T hget(final String key, final String field, final Type type) {
|
||||
if (key == null) return null;
|
||||
@@ -593,6 +601,11 @@ public final class CacheMemorySource<V extends Object> extends AbstractService i
|
||||
return CompletableFuture.supplyAsync(() -> hmget(key, fields), getExecutor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<Map<String, T>> hmapAsync(final String key, final Type type, int offset, int limit) {
|
||||
return CompletableFuture.supplyAsync(() -> hmap(key, type, offset, limit), getExecutor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<T> hgetAsync(final String key, final String field, final Type type) {
|
||||
return CompletableFuture.supplyAsync(() -> hget(key, field, type), getExecutor());
|
||||
|
||||
@@ -99,6 +99,8 @@ public interface CacheSource<V extends Object> {
|
||||
|
||||
public List<Serializable> hmget(final String key, final String... fields);
|
||||
|
||||
public <T> Map<String, T> hmap(final String key, final Type type, int offset, int limit);
|
||||
|
||||
public <T> T hget(final String key, final String field, final Type type);
|
||||
|
||||
public String hgetString(final String key, final String field);
|
||||
@@ -332,6 +334,8 @@ public interface CacheSource<V extends Object> {
|
||||
|
||||
public CompletableFuture<List<Serializable>> hmgetAsync(final String key, final String... fields);
|
||||
|
||||
public <T> CompletableFuture<Map<String, T>> hmapAsync(final String key, final Type type, int offset, int limit);
|
||||
|
||||
public <T> CompletableFuture<T> hgetAsync(final String key, final String field, final Type type);
|
||||
|
||||
public CompletableFuture<String> hgetStringAsync(final String key, final String field);
|
||||
|
||||
Reference in New Issue
Block a user