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

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

Introduction

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

Prototype

void select(int dbIndex);

Source Link

Document

Select the DB with given positive dbIndex .

Usage

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

/**
 * Select the DB with given positive {@code dbIndex}.
 * <p>/*w w  w  . jav  a 2s. c  om*/
 * See http://redis.io/commands/select
 * 
 * @param dbIndex dbIndex
 */
public void select(int dbIndex) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.select(dbIndex);
            return null;
        }
    });
}