本文整理匯總了Java中redis.clients.jedis.Jedis.flushDB方法的典型用法代碼示例。如果您正苦於以下問題:Java Jedis.flushDB方法的具體用法?Java Jedis.flushDB怎麽用?Java Jedis.flushDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類redis.clients.jedis.Jedis
的用法示例。
在下文中一共展示了Jedis.flushDB方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clear
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
@Override
public void clear() throws CacheException {
Jedis jedis = null;
try
{
jedis = redisManager.getJedis();
jedis.select(DB_INDEX);
jedis.flushDB();
}finally
{
if(null != jedis)
{
jedis.close();
}
}
}
示例2: testAddHash
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
@Test
public void testAddHash() throws Exception {
Client cl = new Client("testung", "localhost", 6379);
Jedis conn = cl._conn();
conn.flushDB();
Schema sc = new Schema().addTextField("title", 1.0);
assertTrue(cl.createIndex(sc, Client.IndexOptions.Default()));
HashMap hm = new HashMap();
hm.put("title", "hello world");
conn.hmset("foo", hm);
assertTrue(cl.addHash("foo", 1, false));
SearchResult res = cl.search(new Query("hello world").setVerbatim());
assertEquals(1, res.totalResults);
assertEquals("foo", res.docs.get(0).getId());
}
示例3: flushDB
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public void flushDB() {
Jedis jedis = jedisPool.getResource();
try {
jedis.flushDB();
} catch (Exception e) {
jedisPool.returnBrokenResource(jedis);
} finally {
jedisPool.returnResource(jedis);
}
}
示例4: clearObject
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public void clearObject() {
Jedis jedis = null;
try {
jedis = redisConnection.getJedis();
jedis.select(dbIndex);
jedis.flushDB();
} catch (Exception e) {
log.warn(e.getMessage(), e);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
示例5: clear
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public void clear() {
Jedis jedis = null;
Boolean error = true;
try {
jedis = acquireConnection();
jedis.flushDB();
error = false;
} finally {
if (jedis != null) {
returnConnection(jedis, error);
}
}
}
示例6: clear
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public void clear() {
Jedis jedis = null;
Boolean error = true;
try {
jedis = acquireConnection();
jedis.flushDB();
error = false;
} finally {
if (jedis != null) {
returnConnection(jedis, error);
}
}
}
示例7: createInstance
import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
@Override
public JedisPool createInstance(int connections, String host) {
String[] parts = host.split(":");
JedisPool jp = new JedisPool(parts[0], Integer.valueOf(parts[1]));
Jedis jedis = jp.getResource();
jedis.flushDB();
jedis.close();
return jp;
}