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

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

Introduction

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

Prototype

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

Source Link

Document

Get elements between begin and end from list at the bound key.

Usage

From source file:org.shareok.data.redis.job.JobQueueDaoImpl.java

@Override
public boolean isJobQueueEmpty(String queueName) {
    try {/* ww  w .  j a va  2s  .  c  om*/
        BoundListOperations<String, String> jobQueueOps = (BoundListOperations<String, String>) redisTemplate
                .boundListOps(queueName);
        return jobQueueOps.range(0, ShareokdataManager.getRedisJobQueueMaxJobs()).isEmpty();
    } catch (Exception ex) {
        logger.error("Cannot determine if the job queue " + queueName + " is empty!", ex);
    }
    return false;
}

From source file:org.shareok.data.redis.job.JobQueueDaoImpl.java

@Override
public List getJobQueueByName(String queueName) {
    List jobs = new ArrayList();
    try {// w w w . j  a  v  a 2  s .  co  m
        BoundListOperations<String, String> jobQueueOps = (BoundListOperations<String, String>) redisTemplate
                .boundListOps(queueName);
        jobs = jobQueueOps.range(0, ShareokdataManager.getRedisJobQueueMaxJobs());
    } catch (Exception ex) {
        logger.error("Cannot get the list of the jobs stored in " + queueName, ex);
    }
    return jobs;
}