use of org.redisson.client.protocol.decoder.ListMultiDecoder2 in project redisson by redisson.
the class RedissonGeo method posAsync.
@Override
public RFuture<Map<V, GeoPosition>> posAsync(V... members) {
List<Object> params = new ArrayList<Object>(members.length + 1);
params.add(getRawName());
for (Object member : members) {
params.add(encode(member));
}
MultiDecoder<Map<Object, Object>> decoder = new ListMultiDecoder2(new GeoPositionMapDecoder((List<Object>) Arrays.asList(members)), new GeoPositionDecoder());
RedisCommand<Map<Object, Object>> command = new RedisCommand<Map<Object, Object>>("GEOPOS", decoder);
return commandExecutor.readAsync(getRawName(), StringCodec.INSTANCE, command, params.toArray());
}
use of org.redisson.client.protocol.decoder.ListMultiDecoder2 in project redisson by redisson.
the class RedissonLiveObjectService method findIds.
@Override
public <K> Iterable<K> findIds(Class<?> entityClass, int count) {
NamingScheme namingScheme = commandExecutor.getObjectBuilder().getNamingScheme(entityClass);
String pattern = namingScheme.getNamePattern(entityClass);
RedissonKeys keys = new RedissonKeys(commandExecutor);
RedisCommand<ListScanResult<String>> command = new RedisCommand<>("SCAN", new ListMultiDecoder2(new ListScanResultReplayDecoder(), new ObjectListReplayDecoder<Object>()), new Convertor<Object>() {
@Override
public Object convert(Object obj) {
if (!(obj instanceof String)) {
return obj;
}
return namingScheme.resolveId(obj.toString());
}
});
return keys.getKeysByPattern(command, pattern, 0, count);
}
Aggregations