/** * NOTE: This method will not deserialize Strings returned by Lua scripts, as they may not be encoded with the same * serializer used here. They will be returned as byte[]s */ public <T> T eval(String script, ReturnType returnType, int numKeys, String... keysAndArgs) { return eval(serialize(script), returnType, numKeys, serializeMulti(keysAndArgs)); }
@Override public Long geoAdd(String key, Map<String, Point> memberCoordinateMap) { Assert.notNull(memberCoordinateMap, "MemberCoordinateMap must not be null!"); Map<byte[], Point> byteMap = new HashMap<>(); for (Entry<String, Point> entry : memberCoordinateMap.entrySet()) { byteMap.put(serialize(entry.getKey()), entry.getValue()); } return geoAdd(serialize(key), byteMap); }
@Override public void pfMerge(String destinationKey, String... sourceKeys) { this.pfMerge(serialize(destinationKey), serializeMulti(sourceKeys)); }
@Nullable @Override public Long bitPos(String key, boolean bit, org.springframework.data.domain.Range<Long> range) { return bitPos(serialize(key), bit, range); }
@Override public Boolean setBit(String key, long offset, boolean value) { return setBit(serialize(key), offset, value); }
@Override public Long pTtl(String key, TimeUnit timeUnit) { return pTtl(serialize(key), timeUnit); }
@Override public Long geoAdd(String key, Iterable<GeoLocation<String>> locations) { Assert.notNull(locations, "Locations must not be null!"); Map<byte[], Point> byteMap = new HashMap<>(); for (GeoLocation<String> location : locations) { byteMap.put(serialize(location.getName()), location.getPoint()); } return geoAdd(serialize(key), byteMap); }
@SuppressWarnings("unchecked") private StreamOffset<byte[]>[] serialize(StreamOffset<String>[] offsets) { return Arrays.stream(offsets).map(it -> StreamOffset.create(serialize(it.getKey()), it.getOffset())) .toArray((IntFunction<StreamOffset<byte[]>[]>) StreamOffset[]::new); }
@Override public Set<StringTuple> zRevRangeByScoreWithScores(String key, double min, double max, long offset, long count) { return convertAndReturn(delegate.zRevRangeByScoreWithScores(serialize(key), min, max, offset, count), tupleToStringTuple); }
@Override public Set<StringTuple> zRangeByScoreWithScores(String key, double min, double max, long offset, long count) { return convertAndReturn(delegate.zRangeByScoreWithScores(serialize(key), min, max, offset, count), tupleToStringTuple); }
@Override public List<StringRecord> xReadGroupAsString(Consumer consumer, StreamReadOptions readOptions, StreamOffset<String>... streams) { return convertAndReturn(delegate.xReadGroup(consumer, readOptions, serialize(streams)), listByteMapRecordToStringMapRecordConverter); }
@Override public List<StringRecord> xRevRange(String key, org.springframework.data.domain.Range<String> range, Limit limit) { return convertAndReturn(delegate.xRevRange(serialize(key), range, limit), listByteMapRecordToStringMapRecordConverter); }
@Override public List<StringRecord> xReadAsString(StreamReadOptions readOptions, StreamOffset<String>... streams) { return convertAndReturn(delegate.xRead(readOptions, serialize(streams)), listByteMapRecordToStringMapRecordConverter); }
@Override public Set<String> zRevRangeByScore(String key, double min, double max) { return convertAndReturn(delegate.zRevRangeByScore(serialize(key), min, max), byteSetToStringSet); }
@Override public String xGroupCreate(String key, ReadOffset readOffset, String group) { return convertAndReturn(delegate.xGroupCreate(serialize(key), group, readOffset), identityConverter); }
@Override public List<Long> bitfield(String key, BitFieldSubCommands operation) { List<Long> results = delegate.bitField(serialize(key), operation); if (isFutureConversion()) { addResultConverter(identityConverter); } return results; }