本文整理汇总了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;
}
示例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();
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}