Example usage for org.springframework.data.redis.connection RedisConnection dbSize

List of usage examples for org.springframework.data.redis.connection RedisConnection dbSize

Introduction

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

Prototype

@Nullable
Long dbSize();

Source Link

Document

Get the total number of available keys in currently selected database.

Usage

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

public Long databaseSize() {
    return (Long) redisTemplate.execute(new RedisCallback<Long>() {
        @Override/*w w w  . j  av  a 2  s . c  om*/
        public Long doInRedis(RedisConnection connection) throws DataAccessException {
            return connection.dbSize();
        }
    });
}

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Get the total number of available keys in currently selected database.
 * <p>/*from  w w  w.  j a v  a 2s . c  o m*/
 * See http://redis.io/commands/dbsize
 * 
 * @return Long
 */
public static Long dbSize() {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.dbSize();
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Get the total number of available keys in currently selected database.
 * <p>/*  w  w  w. ja va2  s .co  m*/
 * See http://redis.io/commands/dbsize
 * 
 * @return Long
 */
public Long dbSize() {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.dbSize();
        }
    });
}