當前位置: 首頁>>代碼示例>>Java>>正文


Java JedisPool.returnResourceObject方法代碼示例

本文整理匯總了Java中redis.clients.jedis.JedisPool.returnResourceObject方法的典型用法代碼示例。如果您正苦於以下問題:Java JedisPool.returnResourceObject方法的具體用法?Java JedisPool.returnResourceObject怎麽用?Java JedisPool.returnResourceObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在redis.clients.jedis.JedisPool的用法示例。


在下文中一共展示了JedisPool.returnResourceObject方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAllKeys

import redis.clients.jedis.JedisPool; //導入方法依賴的package包/類
public Set<String> getAllKeys() {
    Set<String> keysSet = new HashSet();
    Collection<JedisPool> poolCollection = jedisCluster.getClusterNodes().values();
    Iterator iterator = poolCollection.iterator();

    while(iterator.hasNext()) {
        JedisPool jedisPool = (JedisPool)iterator.next();
        Jedis jedis = null;

        try {
            jedis = jedisPool.getResource();
            keysSet.addAll(jedis.keys("*"));
        } catch (Exception var10) {
            throw new RuntimeException(var10);
        } finally {
            jedisPool.returnResourceObject(jedis);
        }
    }

    return keysSet;
}
 
開發者ID:bitstd,項目名稱:bitstd,代碼行數:22,代碼來源:RedisCacheWithCluster.java

示例2: publish

import redis.clients.jedis.JedisPool; //導入方法依賴的package包/類
public void publish(String channel, String message) {
    Collection<JedisPool> poolCollection = jedisCluster.getClusterNodes().values();
    Iterator<JedisPool> iterator = poolCollection.iterator();
    if (iterator.hasNext()) {
        JedisPool jedisPool = (JedisPool)iterator.next();
        Jedis jedis = null;

        try {
            jedis = jedisPool.getResource();
            jedis.publish(channel, message);
        } catch (Exception var11) {
            throw new RuntimeException(var11);
        } finally {
            jedisPool.returnResourceObject(jedis);
        }
    }

}
 
開發者ID:bitstd,項目名稱:bitstd,代碼行數:19,代碼來源:RedisCacheWithCluster.java

示例3: subscribe

import redis.clients.jedis.JedisPool; //導入方法依賴的package包/類
public void subscribe(JedisPubSub jedisPubSub, String channel) {
    Collection<JedisPool> poolCollection = jedisCluster.getClusterNodes().values();
    Iterator iterator = poolCollection.iterator();

    while(iterator.hasNext()) {
        JedisPool jedisPool = (JedisPool)iterator.next();
        Jedis jedis = null;

        try {
            jedis = jedisPool.getResource();
            jedis.subscribe(jedisPubSub, new String[]{channel});
        } catch (Exception var11) {
            throw new RuntimeException(var11);
        } finally {
            jedisPool.returnResourceObject(jedis);
        }
    }

}
 
開發者ID:bitstd,項目名稱:bitstd,代碼行數:20,代碼來源:RedisCacheWithCluster.java

示例4: returnNullObjectShouldNotFail

import redis.clients.jedis.JedisPool; //導入方法依賴的package包/類
@Test
public void returnNullObjectShouldNotFail() {
  JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(), hnp.getPort(), 2000,
      "foobared", 0, "my_shiny_client_name");

  pool.returnBrokenResource(null);
  pool.returnResource(null);
  pool.returnResourceObject(null);
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:10,代碼來源:JedisPoolTest.java


注:本文中的redis.clients.jedis.JedisPool.returnResourceObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。