Example usage for org.springframework.data.redis.core BoundSetOperations members

List of usage examples for org.springframework.data.redis.core BoundSetOperations members

Introduction

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

Prototype

@Nullable
Set<V> members();

Source Link

Document

Get all elements of set at the bound key.

Usage

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

@Override
public List<RedisJob> getJobListByUser(long uid) {
    List<RedisJob> jobs = new ArrayList<>();
    try {//from www .  j  a  v a  2 s.  c  o m
        BoundSetOperations<String, String> jobOps = (BoundSetOperations<String, String>) redisTemplate
                .boundSetOps("user_" + String.valueOf(uid) + "_job_set");
        Set<String> jobIds = jobOps.members();
        if (null != jobIds) {
            for (String jobIdStr : jobIds) {
                RedisJob job = findJobByJobId(Long.valueOf(jobIdStr));
                if (null != job) {
                    jobs.add(job);
                }
            }
        } else {
            return null;
        }
    } catch (Exception ex) {
        logger.error("Cannot get the list of the jobs conducted by user " + uid, ex);
    }
    RedisUtil.sortJobList(jobs);
    return jobs;
}