Example usage for org.springframework.data.redis.core BoundZSetOperations persist

List of usage examples for org.springframework.data.redis.core BoundZSetOperations persist

Introduction

In this page you can find the example usage for org.springframework.data.redis.core BoundZSetOperations persist.

Prototype

@Nullable
Boolean persist();

Source Link

Document

Removes the expiration (if any) of the key.

Usage

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();

    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);
}