Java Code Examples for redis.clients.jedis.Jedis#flushAll()
The following examples show how to use
redis.clients.jedis.Jedis#flushAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisClient.java From apollo with GNU General Public License v2.0 | 6 votes |
/** * Delete all the keys of all the existing databases, not just the currently selected one. * * @return false if redis did not execute the option */ public boolean flushall() { String result = ""; Jedis jedis = null; try { jedis = this.jedisPool.getResource(); result = jedis.flushAll(); logger.info("redis client name: " + this.getCacheName() + " flushall."); } catch (Exception e) { logger.error(e.getMessage(), e); this.jedisPool.returnBrokenResource(jedis); } finally { if (jedis != null) { this.jedisPool.returnResource(jedis); } } return "OK".equalsIgnoreCase(result); }
Example 2
Source File: TestRedisQParserPluginIT.java From solr-redis with Apache License 2.0 | 6 votes |
@Before @Override public void setUp() throws Exception { super.setUp(); clearIndex(); assertU(commit()); try { jedis = new Jedis("localhost"); jedis.flushAll(); jedis.sadd("test_set", "test"); jedis.hset("test_hash", "key1", "value1"); jedis.lpush("test_list", "element1"); } catch (final RuntimeException ex) { log.error("Errorw when configuring local Jedis connection", ex); } }
Example 3
Source File: RedisCache.java From framework with Apache License 2.0 | 6 votes |
/** * Description: <br> * * @author 王伟<br> * @taskId <br> */ @Override public void clear() { Jedis jedis = null; try { jedis = jedisPool.getResource(); jedis.flushAll(); } catch (Exception e) { throw new RuntimeException("serial map failed!", e); } finally { if (jedis != null) { jedis.close(); } } }
Example 4
Source File: SessionControllerIntegrationTest.java From tutorials with MIT License | 5 votes |
@Before public void clearRedisData() { testRestTemplate = new TestRestTemplate(); testRestTemplateWithAuth = new TestRestTemplate("admin", "password"); jedis = new Jedis("localhost", 6379); jedis.flushAll(); }
Example 5
Source File: TestTaggedQueryHighlighterIT.java From solr-redis with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); clearIndex(); assertU(commit()); try { jedis = new Jedis("localhost"); jedis.flushAll(); jedis.sadd("test_set1", "test1"); jedis.sadd("test_set2", "test2"); } catch (final RuntimeException ignored) { } }
Example 6
Source File: RedisContainer.java From pay-publicapi with MIT License | 5 votes |
public void clearRedisCache() { Jedis jedis = new Jedis(host, port); String response = jedis.flushAll(); if (!response.equals("OK")) { logger.warn("Unexpected response from redis flushAll command: " + response); } jedis.disconnect(); }
Example 7
Source File: JedisUtil.java From BigData with GNU General Public License v3.0 | 5 votes |
/** * 清空所有key */ public String flushAll() { Jedis jedis = getJedis(); String stata = jedis.flushAll(); returnJedis(jedis); return stata; }
Example 8
Source File: PipeliningTest.java From cachecloud with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { jedis = new Jedis(hnp.getHost(), hnp.getPort(), 2000); jedis.connect(); jedis.auth("foobared"); jedis.flushAll(); }
Example 9
Source File: ClusterCommandsTest.java From cachecloud with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { node1 = new Jedis(nodeInfo1.getHost(), nodeInfo1.getPort()); node1.connect(); node1.flushAll(); node2 = new Jedis(nodeInfo2.getHost(), nodeInfo2.getPort()); node2.connect(); node2.flushAll(); }
Example 10
Source File: TransactionCommandsTest.java From cachecloud with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { super.setUp(); nj = new Jedis(hnp.getHost(), hnp.getPort(), 500); nj.connect(); nj.auth("foobared"); nj.flushAll(); }
Example 11
Source File: JedisCommandTestBase.java From cachecloud with Apache License 2.0 | 5 votes |
protected Jedis createJedis() { Jedis j = new Jedis(hnp.getHost(), hnp.getPort()); j.connect(); j.auth("foobared"); j.flushAll(); return j; }
Example 12
Source File: JedisCommandTestBase.java From cachecloud with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { jedis = new Jedis(hnp.getHost(), hnp.getPort(), 500); jedis.connect(); jedis.auth("foobared"); jedis.configSet("timeout", "300"); jedis.flushAll(); }
Example 13
Source File: JedisUtil.java From Project with Apache License 2.0 | 5 votes |
/** * 清空所有key */ public String flushAll() { Jedis jedis = getJedis(); String stata = jedis.flushAll(); jedis.close(); return stata; }
Example 14
Source File: ClusterBinaryJedisCommandsTest.java From cachecloud with Apache License 2.0 | 4 votes |
@Before public void setUp() throws InterruptedException { node1 = new Jedis(nodeInfo1.getHost(), nodeInfo1.getPort()); node1.connect(); node1.flushAll(); node2 = new Jedis(nodeInfo2.getHost(), nodeInfo2.getPort()); node2.connect(); node2.flushAll(); node3 = new Jedis(nodeInfo3.getHost(), nodeInfo3.getPort()); node3.connect(); node3.flushAll(); // ---- configure cluster // add nodes to cluster node1.clusterMeet("127.0.0.1", nodeInfo2.getPort()); node1.clusterMeet("127.0.0.1", nodeInfo3.getPort()); // split available slots across the three nodes int slotsPerNode = JedisCluster.HASHSLOTS / 3; int[] node1Slots = new int[slotsPerNode]; int[] node2Slots = new int[slotsPerNode + 1]; int[] node3Slots = new int[slotsPerNode]; for (int i = 0, slot1 = 0, slot2 = 0, slot3 = 0; i < JedisCluster.HASHSLOTS; i++) { if (i < slotsPerNode) { node1Slots[slot1++] = i; } else if (i > slotsPerNode * 2) { node3Slots[slot3++] = i; } else { node2Slots[slot2++] = i; } } node1.clusterAddSlots(node1Slots); node2.clusterAddSlots(node2Slots); node3.clusterAddSlots(node3Slots); waitForClusterReady(); jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379)); jedisCluster = new JedisCluster(jedisClusterNode); }
Example 15
Source File: DefaultRedis.java From craft-atom with MIT License | 4 votes |
private String flushall0(Jedis j) { return j.flushAll(); }
Example 16
Source File: SessionLiveTest.java From tutorials with MIT License | 4 votes |
@Before public void setUp() { jedis = new Jedis("localhost", 6379); jedis.flushAll(); }
Example 17
Source File: CrawlDB.java From DistributedCrawler with Apache License 2.0 | 4 votes |
/** * 清空缓存队列 */ public void clean(){ Jedis toj = tocrawl.getResource(); toj.flushAll(); tocrawl.returnResource(toj); }
Example 18
Source File: ClusterScriptingCommandsTest.java From cachecloud with Apache License 2.0 | 4 votes |
@Before public void setUp() throws InterruptedException { node1 = new Jedis(nodeInfo1.getHost(), nodeInfo1.getPort()); node1.connect(); node1.flushAll(); node2 = new Jedis(nodeInfo2.getHost(), nodeInfo2.getPort()); node2.connect(); node2.flushAll(); node3 = new Jedis(nodeInfo3.getHost(), nodeInfo3.getPort()); node3.connect(); node3.flushAll(); // ---- configure cluster // add nodes to cluster node1.clusterMeet("127.0.0.1", nodeInfo2.getPort()); node1.clusterMeet("127.0.0.1", nodeInfo3.getPort()); // split available slots across the three nodes int slotsPerNode = JedisCluster.HASHSLOTS / 3; int[] node1Slots = new int[slotsPerNode]; int[] node2Slots = new int[slotsPerNode + 1]; int[] node3Slots = new int[slotsPerNode]; for (int i = 0, slot1 = 0, slot2 = 0, slot3 = 0; i < JedisCluster.HASHSLOTS; i++) { if (i < slotsPerNode) { node1Slots[slot1++] = i; } else if (i > slotsPerNode * 2) { node3Slots[slot3++] = i; } else { node2Slots[slot2++] = i; } } node1.clusterAddSlots(node1Slots); node2.clusterAddSlots(node2Slots); node3.clusterAddSlots(node3Slots); waitForClusterReady(); jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379)); jedisCluster = new JedisCluster(jedisClusterNode); }
Example 19
Source File: TestFixture.java From shiro-redis with MIT License | 4 votes |
public static void blastRedis() { Jedis jedis = doGetRedisInstance(); jedis.flushAll(); jedis.close(); }
Example 20
Source File: RedisLock.java From distributed-lock-redis with MIT License | 4 votes |
public void flushAll() { Jedis jedis = jedisPool.getResource(); jedis.flushAll(); }