Example usage for org.springframework.data.redis.connection StringRedisConnection rPop

List of usage examples for org.springframework.data.redis.connection StringRedisConnection rPop

Introduction

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

Prototype

String rPop(String key);

Source Link

Document

Removes and returns last element in list stored at key .

Usage

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

/**
 * 4.10. Pipelining - http://docs.spring.io/spring-data/redis/docs/current/reference/html/
 * @param key/*  www.j av a2s .co  m*/
 * @return 
 */
public List<Object> pipelining(final String key) {
    //pop a specified number of items from a queue
    List<Object> results = redisTemplate.executePipelined(new RedisCallback<Object>() {
        @Override
        public Object doInRedis(RedisConnection connection) throws DataAccessException {
            StringRedisConnection stringRedisConn = (StringRedisConnection) connection;
            for (int i = 0; i < 10; i++) {
                stringRedisConn.rPop(key);
            }
            return null;
        }
    });

    return results;
}