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

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

Introduction

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

Prototype

void flushDb();

Source Link

Document

Delete all keys of the currently selected database.

Usage

From source file:example.BasicUsageTests.java

@Before
public void setUp() {

    template.execute(new RedisCallback<String>() {

        @Override/*w  w w  . ja  va  2 s .  co m*/
        public String doInRedis(RedisConnection connection) throws DataAccessException {
            connection.flushDb();
            return "FLUSHED";
        }
    });
}

From source file:stormy.pythian.service.topology.TopologyRepositoryIntegrationTest.java

@After
@Before/*  ww w .  j  a v a  2  s  . co m*/
public void cleanRedisDB() {
    RedisConnection connection = redisTemplate.getConnectionFactory().getConnection();
    connection.flushDb();
    connection.close();
}

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

@Override
public void clear() {
    redisTemplate.execute(new RedisCallback<String>() {
        public String doInRedis(RedisConnection connection) throws DataAccessException {
            connection.flushDb();
            return "ok";
        }/*from   w  ww  .  j  ava  2 s  .  com*/
    });
}

From source file:example.springdata.redis.repositories.PersonRepositoryTests.java

@Before
@After/*w ww.  ja  v a2 s.co m*/
public void setUp() {

    operations.execute((RedisConnection connection) -> {
        connection.flushDb();
        return "OK";
    });
}

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

/**
 * Delete all keys of the currently selected database.
 * <p>//from   w ww  .j a  v a 2 s.co m
 * See http://redis.io/commands/flushdb
 */
public static void flushDb() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.flushDb();
            return null;
        }
    });
}

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

/**
 * Delete all keys of the currently selected database.
 * <p>/*from  w  ww  .  ja  v a 2 s.  c o  m*/
 * See http://redis.io/commands/flushdb
 */
public void flushDb() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.flushDb();
            return null;
        }
    });
}