本文整理了Java中redis.clients.jedis.Jedis.flushDB()
方法的一些代码示例,展示了Jedis.flushDB()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.flushDB()
方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:flushDB
暂无
代码示例来源:origin: jfinal/jfinal
/**
* 删除当前 db 所有数据
*/
public String flushDB() {
Jedis jedis = getJedis();
try {
return jedis.flushDB();
}
finally {close(jedis);}
}
代码示例来源:origin: Dreampie/Resty
Collection<Jedis> shards = shardedJedis.getAllShards();
for (Jedis j : shards) {
j.flushDB();
if (jedis != null) {
if (event.getType().equals(CacheEvent.CacheEventType.ALL)) {
jedis.flushDB();
} else if (event.getType().equals(CacheEvent.CacheEventType.GROUP)) {
byte[] groupRawKey=event.getGroup().getBytes();
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public void flushDb() {
try {
if (isPipelined()) {
pipeline(connection.newStatusResult(connection.getRequiredPipeline().flushDB()));
return;
}
if (isQueueing()) {
transaction(connection.newStatusResult(connection.getRequiredTransaction().flushDB()));
return;
}
connection.getJedis().flushDB();
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: sanluan/PublicCMS
/**
*
*/
public void flushDb() {
log.info("flush db...");
Jedis jedis = jedisPool.getResource();
jedis.flushDB();
jedis.close();
}
代码示例来源:origin: sanluan/PublicCMS
/**
*
*/
public void flushDb() {
log.info("flush db...");
Jedis jedis = jedisPool.getResource();
jedis.flushDB();
jedis.close();
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testFlushDb() throws Exception {
try (Jedis jedis = pool.getResource()) {
Assert.assertEquals(0, (long)jedis.dbSize());
jcache().putAll(new HashMap<Integer, Integer>() {
{
for (int i = 0; i < 100; i++)
put(i, i);
}
});
Assert.assertEquals(100, (long)jedis.dbSize());
jedis.select(1);
jcache().putAll(new HashMap<Integer, Integer>() {
{
for (int i = 0; i < 100; i++)
put(i, i);
}
});
// flush database 1.
jedis.flushDB();
Assert.assertEquals(0, (long)jedis.dbSize());
jedis.select(0);
Assert.assertEquals(100, (long)jedis.dbSize());
}
}
代码示例来源:origin: io.leopard/leopard-redis
@Override
public Object execute(Jedis jedis) {
jedis.flushDB();
return true;
}
});
代码示例来源:origin: zhangyd-c/OneBlog
@Override
public void flushDB() {
try (Jedis jedis = jedisPool.getResource()) {
jedis.flushDB();
}
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public String flushDB() {
String command = "flushDB";
return instrumented(command, () -> delegated.flushDB());
}
代码示例来源:origin: wang926454/ShiroJwt
/**
* 清空所有缓存
*/
@Override
public void clear() throws CacheException {
JedisUtil.getJedis().flushDB();
}
代码示例来源:origin: elunez/eladmin
@Override
public void flushdb() {
Jedis jedis = null;
try{
jedis = pool.getResource();
jedis.flushDB();
}finally{
if(null != jedis){
jedis.close(); // 释放资源还给连接池
}
}
}
}
代码示例来源:origin: rpatil26/webutilities
@Override
public void invalidateAll() {
Jedis jedis = this.jedisPool.getResource();
try {
jedis.flushDB();
} finally {
if (jedis != null) {
this.jedisPool.returnResource(jedis);
}
}
}
代码示例来源:origin: org.tinygroup/org.tinygroup.jedis
public void flushDB() {
Collection<Jedis> jedisSet = getAllShards();
for (Jedis jedis : jedisSet) {
jedis.flushDB();
}
}
代码示例来源:origin: huhuics/joice
@Override
public void clear() {
Collection<Jedis> shards = shardedJedis.getAllShards();
Iterator<Jedis> iterator = shards.iterator();
while (iterator.hasNext()) {
Jedis jedis = iterator.next();
jedis.flushDB();
}
}
代码示例来源:origin: com.jfinal/jfinal
/**
* 删除当前 db 所有数据
*/
public String flushDB() {
Jedis jedis = getJedis();
try {
return jedis.flushDB();
}
finally {close(jedis);}
}
代码示例来源:origin: org.nutz/nutz-integration-jedis
/**
* Delete all the keys of the currently selected DB. This command never fails.
*
* @return Status code reply
*/
public String flushDB() {
Jedis jedis = getJedis();
try {
return jedis.flushDB();
} finally {Streams.safeClose(jedis);}
}
代码示例来源:origin: biezhi/java-library-examples
public static void main(String[] args) {
try (Jedis jedis = JedisUtil.getInstance().getJedis()) {
System.out.println("=============key==========================");
// 清空数据
System.out.println(jedis.flushDB());
System.out.println(jedis.echo("foo"));
// 判断key否存在
System.out.println(jedis.exists("foo"));
jedis.set("key", "values");
System.out.println(jedis.exists("key"));
}
}
代码示例来源:origin: SkyScraperTwc/SecKillDesign
@PostConstruct
public void initRedis(){
Jedis jedis = redisCacheHandle.getJedis();
//清空Redis缓存
jedis.flushDB();
List<Product> productList = secKillMapper.getAllProduct();
for (Product product:productList) {
jedis.set(product.getProductName()+"_stock", String.valueOf(product.getStock()));
}
log.info("Redis缓存数据初始化完毕!");
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void tearDown()
throws Exception
{
try( Jedis jedis = jedisPool.getResource() )
{
jedis.flushDB();
}
super.tearDown();
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void tearDown()
throws Exception
{
try( Jedis jedis = jedisPool.getResource() )
{
jedis.flushDB();
}
super.tearDown();
}
}
内容来源于网络,如有侵权,请联系作者删除!