Search in sources :

Example 1 with ScoredCodec

use of org.redisson.client.codec.ScoredCodec 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(getName());
    params.addAll(Arrays.asList(members));
    MultiDecoder<Map<Object, Object>> decoder = new NestedMultiDecoder(new GeoPositionDecoder(), new GeoPositionMapDecoder(params), true);
    RedisCommand<Map<Object, Object>> command = new RedisCommand<Map<Object, Object>>("GEOPOS", decoder, 2, ValueType.OBJECTS);
    return commandExecutor.readAsync(getName(), new ScoredCodec(codec), command, params.toArray());
}
Also used : GeoPositionMapDecoder(org.redisson.client.protocol.decoder.GeoPositionMapDecoder) ArrayList(java.util.ArrayList) RedisCommand(org.redisson.client.protocol.RedisCommand) ScoredCodec(org.redisson.client.codec.ScoredCodec) GeoPositionDecoder(org.redisson.client.protocol.decoder.GeoPositionDecoder) FlatNestedMultiDecoder(org.redisson.client.protocol.decoder.FlatNestedMultiDecoder) NestedMultiDecoder(org.redisson.client.protocol.decoder.NestedMultiDecoder) Map(java.util.Map)

Example 2 with ScoredCodec

use of org.redisson.client.codec.ScoredCodec in project redisson by redisson.

the class RedissonGeo method hashAsync.

@Override
public RFuture<Map<V, String>> hashAsync(V... members) {
    List<Object> params = new ArrayList<Object>(members.length + 1);
    params.add(getName());
    params.addAll(Arrays.asList(members));
    RedisCommand<Map<Object, Object>> command = new RedisCommand<Map<Object, Object>>("GEOHASH", new MapGetAllDecoder(params, 1), 2, ValueType.OBJECTS);
    return commandExecutor.readAsync(getName(), new ScoredCodec(codec), command, params.toArray());
}
Also used : ArrayList(java.util.ArrayList) RedisCommand(org.redisson.client.protocol.RedisCommand) ScoredCodec(org.redisson.client.codec.ScoredCodec) MapGetAllDecoder(org.redisson.connection.decoder.MapGetAllDecoder) Map(java.util.Map)

Aggregations

ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 ScoredCodec (org.redisson.client.codec.ScoredCodec)2 RedisCommand (org.redisson.client.protocol.RedisCommand)2 FlatNestedMultiDecoder (org.redisson.client.protocol.decoder.FlatNestedMultiDecoder)1 GeoPositionDecoder (org.redisson.client.protocol.decoder.GeoPositionDecoder)1 GeoPositionMapDecoder (org.redisson.client.protocol.decoder.GeoPositionMapDecoder)1 NestedMultiDecoder (org.redisson.client.protocol.decoder.NestedMultiDecoder)1 MapGetAllDecoder (org.redisson.connection.decoder.MapGetAllDecoder)1