当前位置: 首页>>代码示例>>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;未经允许,请勿转载。