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


Java Jedis.smembers方法代碼示例

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


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

示例1: getSet

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
 * 獲取緩存
 *
 * @param key 鍵
 * @return 值
 */
public static Set<String> getSet(String key) {
	Set<String> value = null;
	Jedis jedis = null;
	try {
		jedis = getResource();
		if (jedis.exists(key)) {
			value = jedis.smembers(key);
			logger.debug("getSet {} = {}", key, value);
		}
	} catch (Exception e) {
		logger.warn("getSet {} = {}", key, value, e);
	} finally {
		returnResource(jedis);
	}
	return value;
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:23,代碼來源:JedisUtils.java

示例2: getObjectSet

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
 * 獲取緩存
 *
 * @param key 鍵
 * @return 值
 */
public static Set<Object> getObjectSet(String key) {
	Set<Object> value = null;
	Jedis jedis = null;
	try {
		jedis = getResource();
		if (jedis.exists(getBytesKey(key))) {
			value = Sets.newHashSet();
			Set<byte[]> set = jedis.smembers(getBytesKey(key));
			for (byte[] bs : set) {
				value.add(toObject(bs));
			}
			logger.debug("getObjectSet {} = {}", key, value);
		}
	} catch (Exception e) {
		logger.warn("getObjectSet {} = {}", key, value, e);
	} finally {
		returnResource(jedis);
	}
	return value;
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:27,代碼來源:JedisUtils.java

示例3: smembersString

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public Set<String> smembersString(String key) {
	Jedis jedis = null;
	boolean success = true;
	Set<String> ret = null;
	try {
		jedis = jedisPool.getResource();
		if (jedis == null) {
			success = false;
			return ret;
		}
		ret = jedis.smembers(key);
	} catch (Exception e) {
		success = false;
		returnBrokenResource(jedis, "smembersString" + key, e);
	} finally {
		releaseReidsSource(success, jedis);
	}
	return ret;
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:20,代碼來源:RedisService.java

示例4: sMembers

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public Set<String> sMembers(String key) {
	int tries = 0;
	boolean sucess = false;
	Set<String> retVal = null;
	do {
		tries++;
		try {
			Jedis jedis = pool.getResource();
			retVal = jedis.smembers(key);
			jedis.close();
			sucess = true;
		} catch (JedisConnectionException ex) {
			log.error(RedisConstants.CONN_FAILED_RETRY_MSG + tries);
			if (tries == numRetries)
				throw ex;
		}
	} while (!sucess && tries <= numRetries);
	return retVal;
}
 
開發者ID:ran-jit,項目名稱:distributed-task-scheduler,代碼行數:22,代碼來源:RedisDataCache.java

示例5: getVByList

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
 * 往redis裏取set整個集合
 * 
 * @param <T>
 * @param setKey
 * @param start
 * @param end
 * @param requiredType
 * @return
 */
@SuppressWarnings("unchecked")
public <T> Set<T> getVByList(String setKey,Class<T> requiredType) throws Exception {
	Jedis jds = null;
	try {
		jds = getJedis();
		jds.select(0);
		Set<T> set = new TreeSet<T>();
		Set<byte[]> xx = jds.smembers(setKey.getBytes());
		for (byte[] bs : xx) {
			T t = SerializeUtil.deserialize(bs, requiredType);
			set.add(t);
		}
		return set;
	} catch (Exception e) {
		throw e;
	} finally {
		if(jds != null)
		{
			jds.close();
		}
	}
}
 
開發者ID:wjggwm,項目名稱:webside,代碼行數:33,代碼來源:RedisManager.java

示例6: getSetByKey

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
 * 取set 
 * @param key
 * @return
 */
public Set<String> getSetByKey(String key) throws Exception {
	Jedis jds = null;
	try {
		jds = getJedis();
		jds.select(0);
		Set<String> result = jds.smembers(key);
		return result;
	} catch (Exception e) {
		throw e;
       } finally {
       	if(jds != null)
		{
			jds.close();
		}
       }
	 
}
 
開發者ID:wjggwm,項目名稱:webside,代碼行數:23,代碼來源:RedisManager.java

示例7: getSet

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
 * 獲取緩存
 * @param key 鍵
 * @return 值
 */
public static Set<String> getSet(String key) {
	Set<String> value = null;
	Jedis jedis = null;
	try {
		jedis = getResource();
		if (jedis.exists(key)) {
			value = jedis.smembers(key);
			logger.debug("getSet {} = {}", key, value);
		}
	} catch (Exception e) {
		logger.warn("getSet {} = {}", key, value, e);
	} finally {
		returnResource(jedis);
	}
	return value;
}
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:22,代碼來源:JedisUtils.java

示例8: getObjectSet

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
/**
 * 獲取緩存
 * @param key 鍵
 * @return 值
 */
public static Set<Object> getObjectSet(String key) {
	Set<Object> value = null;
	Jedis jedis = null;
	try {
		jedis = getResource();
		if (jedis.exists(getBytesKey(key))) {
			value = Sets.newHashSet();
			Set<byte[]> set = jedis.smembers(getBytesKey(key));
			for (byte[] bs : set){
				value.add(toObject(bs));
			}
			logger.debug("getObjectSet {} = {}", key, value);
		}
	} catch (Exception e) {
		logger.warn("getObjectSet {} = {}", key, value, e);
	} finally {
		returnResource(jedis);
	}
	return value;
}
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:26,代碼來源:JedisUtils.java

示例9: loadPlayer

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public void loadPlayer(UUID player)
{
    try{
        FriendPlayer friendPlayer = new FriendPlayer(player);
        Jedis jedis = api.getBungeeResource();
        Set<String> smembers = jedis.smembers(key + player);
        jedis.close();
        for (String friend : smembers)
        {
            friendPlayer.addFriend(UUID.fromString(friend));
        }
        cache.put(player, friendPlayer);
    }catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:18,代碼來源:FriendsManager.java

示例10: ChatHandleListener

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public ChatHandleListener(APIPlugin plugin)
{
    super(plugin);

    Jedis jedis = api.getBungeeResource();

    for (String blacklisted : jedis.smembers("chat:blacklist"))
    {
        if (blacklisted.contains("="))
            blacklist.put(blacklisted.split("=")[0], blacklisted.split("=")[1]);
        else
            blacklist.put(blacklisted, null);
    }

    jedis.close();
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:17,代碼來源:ChatHandleListener.java

示例11: smembers

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
@Override
public Set<String> smembers(String key) {
    Jedis jedis = null;
    Set<String> res = null;
    try {
        jedis = pool.getResource();
        res = jedis.smembers(key);
    } catch (Exception e) {

        LOGGER.error(e.getMessage());
    } finally {
        returnResource(pool, jedis);
    }
    return res;
}
 
開發者ID:wxiaoqi,項目名稱:ace-cache,代碼行數:16,代碼來源:RedisServiceImpl.java

示例12: run

import redis.clients.jedis.Jedis; //導入方法依賴的package包/類
public void run()
{
    Jedis jedis = databaseConnector.getBungeeResource();
    Set<String> whiteList = jedis.smembers("proxys");
    jedis.close();

    plugin.refreshIps(whiteList);
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:9,代碼來源:WhiteListRefreshTask.java


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