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

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

Introduction

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

Prototype

@Nullable
Long size(K key);

Source Link

Document

Get the size of list stored at key .

Usage

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

/**
* Count elements of a list/*from  ww  w  .  java2s . com*/
* @param       key
* @return      number of element/s
*/
public long countList(String key) {
    ListOperations opsForList = redisTemplate.opsForList();
    return opsForList.size(key);
}