List of usage examples for org.springframework.data.redis.connection RedisConnection zRangeByLex
@Nullable default Set<byte[]> zRangeByLex(byte[] key, Range range)
From source file:example.RedisOperationsTests.java
@Test public void zrangeByLex() { BoundZSetOperations<String, String> zsets = redis.boundZSetOps("myzset"); zsets.add("a", 0.0); zsets.add("b", 0.0); zsets.add("c", 0.0); zsets.add("d", 0.0); zsets.add("e", 0.0); zsets.add("f", 0.0); zsets.add("g", 0.0); zsets.persist();//from www .j a v a2 s . c om RedisConnection redisConnection = redisConnectionFactory.getConnection(); redisConnection.zRangeByLex("myzset".getBytes(), Range.range().lte("c")).stream().// map(it -> new String(it)).// forEach(System.out::println); System.out.println("###"); redisConnection.zRangeByLex("myzset".getBytes(), Range.range().lt("c")).stream().// map(it -> new String(it)).// forEach(System.out::println); System.out.println("###"); redisConnection.zRangeByLex("myzset".getBytes(), Range.range().gt("aaa").lt("g")).stream().// map(it -> new String(it)).// forEach(System.out::println); }
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Get all the elements in {@link Range} from the sorted set at {@literal key} in lexicographical ordering. * /*from w w w.j a v a2 s. c o m*/ * @param key must not be {@literal null}. * @param range must not be {@literal null}. * @return Set<byte[]> * @since 1.6 */ public static Set<byte[]> zRangeByLex(byte[] key, Range range) { return redisTemplate.execute(new RedisCallback<Set<byte[]>>() { @Override public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.zRangeByLex(key, range); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Get all the elements in {@link Range} from the sorted set at {@literal key} in lexicographical ordering. * /*w ww. j a v a 2s.c om*/ * @param key must not be {@literal null}. * @param range must not be {@literal null}. * @return Set<byte[]> * @since 1.6 */ public Set<byte[]> zRangeByLex(byte[] key, Range range) { return redisTemplate.execute(new RedisCallback<Set<byte[]>>() { @Override public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException { return redis.zRangeByLex(key, range); } }); }