redis.clients.jedis.Jedis.flushAll()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(364)

本文整理了Java中redis.clients.jedis.Jedis.flushAll()方法的一些代码示例,展示了Jedis.flushAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.flushAll()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:flushAll

Jedis.flushAll介绍

暂无

代码示例

代码示例来源:origin: jfinal/jfinal

/**
 * 删除所有 db 的所有数据
 */
public String flushAll() {
  Jedis jedis = getJedis();
  try {
    return jedis.flushAll();
  }
  finally {close(jedis);}
}

代码示例来源:origin: apache/ignite

/**
   * @throws Exception If failed.
   */
  @Test
  public void testFlushAll() throws Exception {
    try (Jedis jedis = pool.getResource()) {
      Assert.assertEquals(0, (long)jedis.dbSize());

      for (int i = 0; i < 100; i++)
        jedis.set(String.valueOf(i), String.valueOf(i));

      Assert.assertEquals(100, (long)jedis.dbSize());

      jedis.select(1);

      for (int i = 0; i < 100; i++)
        jedis.set(String.valueOf(i), String.valueOf(i));

      Assert.assertEquals(100, (long)jedis.dbSize());

      jedis.flushAll();

      Assert.assertEquals(0, (long)jedis.dbSize());

      jedis.select(0);

      Assert.assertEquals(0, (long)jedis.dbSize());
    }
  }
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public void flushAll() {
  try {
    if (isPipelined()) {
      pipeline(connection.newStatusResult(connection.getRequiredPipeline().flushAll()));
      return;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().flushAll()));
      return;
    }
    connection.getJedis().flushAll();
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: yrain/smart-cache

@Override
  public Void doInJedis(Jedis jedis) {
    jedis.flushAll();
    return null;
  }
});

代码示例来源:origin: hltfbk/Excitement-Open-Platform

@Override
public void reset() {
  jedis.flushAll();
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
  public Object execute(Jedis jedis) {
    jedis.flushAll();
    return true;
  }
});

代码示例来源:origin: hltfbk/Excitement-Open-Platform

public void clear() {
  jedis.flushAll();
}

代码示例来源:origin: org.tinygroup/org.tinygroup.jedis

public void flushAll() {
  Collection<Jedis> jedisSet = getAllShards();
  for (Jedis jedis : jedisSet) {
    jedis.flushAll();
  }
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public String flushAll() {
 String command = "flushAll";
 return instrumented(command, () -> delegated.flushAll());
}

代码示例来源:origin: hltfbk/Excitement-Open-Platform

@Override
public synchronized void reset() {
  jedis.flushAll();
  id2item.clear();
}

代码示例来源:origin: hltfbk/Excitement-Open-Platform

@Override
public void loadState(PersistenceDevice... devices) throws LoadingStateException {
  jedis.flushAll();
  super.loadState(devices);
}

代码示例来源:origin: hltfbk/Excitement-Open-Platform

protected void initRedis(String host,int port) {
  JedisPool pool = new JedisPool(new JedisPoolConfig(), host,port);
  jedis = pool.getResource();
  jedis.connect();
  jedis.getClient().setTimeoutInfinite();
  jedis.flushAll();
}
protected UnlimitedMemoryBasedCountableIdentifiableStorage() {

代码示例来源:origin: xiangwbs/springboot

/**
 * 刷新缓存
 */
public void flushAll() {
  Jedis jedis = null;
  try {
    jedis = getJedis();
    jedis.flushAll();
  } finally {
    returnJedis(jedis);
  }
}

代码示例来源:origin: com.jfinal/jfinal

/**
 * 删除所有 db 的所有数据
 */
public String flushAll() {
  Jedis jedis = getJedis();
  try {
    return jedis.flushAll();
  }
  finally {close(jedis);}
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

/**
 * Delete all the keys of all the existing databases, not just the currently selected one. This
 * command never fails.
 *
 * @return Status code reply
 */
public String flushAll() {
  Jedis jedis = getJedis();
  try {
    return jedis.flushAll();
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: swisspush/gateleen

@Before
public void connect() {
  jedis = new Jedis("localhost", 6379, 5000);
  jedis.flushAll();
}

代码示例来源:origin: swisspush/gateleen

@After
public void disconnect() {
  jedis.flushAll();
  jedis.close();
}

代码示例来源:origin: lordofthejars/nosql-unit

@Override
public void deleteAll() {
  forEach(shardedJedis.getAllShards()).flushAll();
}

代码示例来源:origin: com.lordofthejars/nosqlunit-redis

@Override
public void deleteAll() {
  forEach(shardedJedis.getAllShards()).flushAll();
}

代码示例来源:origin: swisspush/gateleen

@BeforeClass
public static void checkRedisAvailable(){
  Jedis j = new Jedis("localhost", 6379, 5000);
  try {
    j.flushAll();
  } catch (JedisConnectionException e){
    org.junit.Assume.assumeNoException("Ignoring this test because no running redis is available. This is the case during release", e);
  }
}

相关文章

Jedis类方法