Example usage for org.springframework.data.redis.connection DefaultSortParameters DefaultSortParameters

List of usage examples for org.springframework.data.redis.connection DefaultSortParameters DefaultSortParameters

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection DefaultSortParameters DefaultSortParameters.

Prototype

public DefaultSortParameters(@Nullable Range limit, @Nullable Order order, @Nullable Boolean alphabetic) 

Source Link

Document

Constructs a new DefaultSortParameters instance.

Usage

From source file:org.springframework.data.redis.connection.jredis.JRedisConnectionIntegrationTests.java

@Test
public void testSort() {
    connection.rPush("sortlist", "foo");
    connection.rPush("sortlist", "bar");
    connection.rPush("sortlist", "baz");
    assertEquals(Arrays.asList(new String[] { "bar", "baz", "foo" }),
            connection.sort("sortlist", new DefaultSortParameters(null, Order.ASC, true)));
}

From source file:org.springframework.data.redis.connection.jredis.JRedisConnectionIntegrationTests.java

@Test
public void testSortStore() {
    connection.rPush("sortlist", "foo");
    connection.rPush("sortlist", "bar");
    connection.rPush("sortlist", "baz");
    assertEquals(Long.valueOf(3),
            connection.sort("sortlist", new DefaultSortParameters(null, Order.ASC, true), "newlist"));
    assertEquals(Arrays.asList(new String[] { "bar", "baz", "foo" }), connection.lRange("newlist", 0, 9));
}