当前位置: 首页>>代码示例>>Java>>正文


Java Jedis.zrem方法代码示例

本文整理汇总了Java中redis.clients.jedis.Jedis.zrem方法的典型用法代码示例。如果您正苦于以下问题:Java Jedis.zrem方法的具体用法?Java Jedis.zrem怎么用?Java Jedis.zrem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redis.clients.jedis.Jedis的用法示例。


在下文中一共展示了Jedis.zrem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: zRemByMember

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
 * 删除zset 的成员
 * 
 * @param key
 * @param member
 * @return
 */
public long zRemByMember(String key, String member) {
	Jedis jedis = null;
	boolean success = true;
	long ret = 0L;
	try {
		jedis = jedisPool.getResource();
		if (jedis == null) {
			success = false;
			return ret;
		}
		ret = jedis.zrem(key, member);
	} catch (Exception e) {
		success = false;
		returnBrokenResource(jedis, "zrangeByScoreWithScores", e);
	} finally {
		releaseReidsSource(success, jedis);
	}
	return ret;
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:27,代码来源:RedisService.java

示例2: doPoll

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public Request doPoll(Task task) {
    Jedis jedis = jedisPool.getResource();
    try {
        String content = null;
        Set<String> contents = jedis.zrevrange(RedisKeys.getZsetPlusPriorityKey(task), 0, 0);
        if (contents != null && !contents.isEmpty()) {
            content = contents.toArray(new String[0])[0];
            jedis.zrem(RedisKeys.getZsetPlusPriorityKey(task), content);
        } else {
            content = jedis.lpop(RedisKeys.getQueueNoPriorityKey(task));
            if (StringUtils.isBlank(content)) {
                contents = jedis.zrevrange(RedisKeys.getZsetMinusPriorityKey(task), 0, 0);
                if (contents != null && !contents.isEmpty()) {
                    content = contents.toArray(new String[0])[0];
                    jedis.zrem(RedisKeys.getZsetPlusPriorityKey(task), content);
                }
            }
        }

        return StringUtils.isNotBlank(content) ? serializer.deserialize(content) : null;
    } finally {
        jedis.close();
    }
}
 
开发者ID:brucezee,项目名称:jspider,代码行数:26,代码来源:RedisPriorityScheduler.java

示例3: zRemByMemberReturnBoolean

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
 * 删除zset 的成员
 * 
 * @param key
 * @param member
 * @return
 */
public boolean zRemByMemberReturnBoolean(String key, String member) {
	Jedis jedis = null;
	boolean success = true;
	boolean ret = false;
	try {
		jedis = jedisPool.getResource();
		if (jedis == null) {
			success = false;
			return ret;
		}
		ret = (jedis.zrem(key, member) > 0);
	} catch (Exception e) {
		success = false;
		returnBrokenResource(jedis, "zrangeByScoreWithScores", e);
	} finally {
		releaseReidsSource(success, jedis);
	}
	return ret;
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:27,代码来源:RedisService.java

示例4: zrem

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public void zrem(String key, String member) {
    Jedis jedis = null;
    try {
        jedis = getJedis();
        if (jedis == null) {
            logger.error("get jedis fail");
        }
        jedis.zrem(key, member);
    } catch (JedisConnectionException e) {
        if (jedis != null) {
            jedis.close();
        }
    } finally {
        returnJedisResource(jedis);
    }
}
 
开发者ID:Zephery,项目名称:newblog,代码行数:17,代码来源:JedisUtil.java

示例5: zRemove

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public Long zRemove(String key, Object... data) {
	int tries = 0;
	Long retVal = null;
	boolean sucess = false;
	do {
		tries++;
		try {
			Jedis jedis = pool.getResource();
			retVal = jedis.zrem(key, SerializationUtil.serialize(data));
			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

示例6: onHubShutdown

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
public void onHubShutdown(MinecraftServerS serverS)
{
    if(serverS == null)
        return;

    try
    {
        Jedis jedis = instance.getDatabaseConnector().getResource();
        jedis.zrem("lobbybalancer", serverS.getServerName());
        jedis.close();
    } catch (Exception e)
    {
        e.printStackTrace();
    }

    hubs.remove(serverS);
    serverS.unregisterNetwork();
}
 
开发者ID:SamaGames,项目名称:Hydroangeas,代码行数:19,代码来源:HubBalancer.java

示例7: zrem

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
/**
 * 移除有序列表成员
 *
 * @param key     key
 * @param members 待移除的成员
 * @return Long
 */
public Long zrem(String key, String... members) {
    Jedis jedis = null;

    try {
        jedis = getConnect();
        return jedis.zrem(key, members);
    } catch (Exception e) {
        logger.error("redis zrem data failed!", e);
        return 0L;
    } finally {
        close(jedis);
    }
}
 
开发者ID:TwoDragonLake,项目名称:tdl-seckill,代码行数:21,代码来源:RedisUtil.java

示例8: zrem

import redis.clients.jedis.Jedis; //导入方法依赖的package包/类
@Override
public Long zrem(String key, String... members) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = pool.getResource();
        res = jedis.zrem(key, members);
    } catch (Exception e) {

        LOGGER.error(e.getMessage());
    } finally {
        returnResource(pool, jedis);
    }
    return res;
}
 
开发者ID:wxiaoqi,项目名称:ace-cache,代码行数:16,代码来源:RedisServiceImpl.java


注:本文中的redis.clients.jedis.Jedis.zrem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。