Example usage for org.springframework.data.redis.connection RedisConnection sort

List of usage examples for org.springframework.data.redis.connection RedisConnection sort

Introduction

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

Prototype

@Nullable
Long sort(byte[] key, SortParameters params, byte[] storeKey);

Source Link

Document

Sort the elements for key and store result in storeKey .

Usage

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Sort the elements for {@code key} and store result in {@code storeKey}.
 * <p>/*from   w  ww  .ja va 2s .  c om*/
 * See http://redis.io/commands/sort
 * 
 * @param key key
 * @param params params
 * @param storeKey storeKey
 * @return Long
 */
public static Long sort(byte[] key, SortParameters params, byte[] storeKey) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sort(key, params, storeKey);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Sort the elements for {@code key} and store result in {@code storeKey}.
 * <p>/*from w w  w  .  j av  a2s  .c  o m*/
 * See http://redis.io/commands/sort
 * 
 * @param key key
 * @param params params
 * @param storeKey storeKey
 * @return Long
 */
public Long sort(byte[] key, SortParameters params, byte[] storeKey) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.sort(key, params, storeKey);
        }
    });
}