Example usage for org.springframework.data.redis.core ListOperations range

List of usage examples for org.springframework.data.redis.core ListOperations range

Introduction

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

Prototype

@Nullable
List<V> range(K key, long start, long end);

Source Link

Document

Get elements between begin and end from list at key .

Usage

From source file:com.company.project.service.dao.RedisDao.java

/**
 * Get elements between start and end position of list
 * @param key//from   w  w w .j av  a2  s  .  co m
 * @param start
 * @param end       -1 means last element
 * @return 
 */
public List multiGetList(String key, int start, int end) {
    ListOperations opsForList = redisTemplate.opsForList();
    return opsForList.range(key, start, end); //start and end of range. -1 means up to end of list
}