redis.clients.jedis.Jedis.srem()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(238)

本文整理了Java中redis.clients.jedis.Jedis.srem()方法的一些代码示例,展示了Jedis.srem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.srem()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:srem

Jedis.srem介绍

[英]Remove the specified member from the set value stored at key. If member was not a member of the set no operation is performed. If key does not hold a set value an error is returned.

Time complexity O(1)
[中]从键处存储的集合值中删除指定的成员。如果成员不是集合的成员,则不执行任何操作。如果键不包含设置值,则返回错误。
时间复杂度O(1)

代码示例

代码示例来源:origin: sohutv/cachecloud

@Override
 public Long execute(Jedis connection) {
  return connection.srem(key, member);
 }
}.runBinary(key);

代码示例来源:origin: sohutv/cachecloud

@Override
 public Long execute(Jedis connection) {
  return connection.srem(key, member);
 }
}.run(key);

代码示例来源:origin: sohutv/cachecloud

public Long execute(Jedis connection) {
    return connection.srem(keyByte, member);
  }
}.runBinary(keyByte);

代码示例来源:origin: sohutv/cachecloud

@Override
public Long srem(String key, String... members) {
 Jedis j = getShard(key);
 return j.srem(key, members);
}

代码示例来源:origin: sohutv/cachecloud

@Override
public Long srem(byte[] key, byte[]... members) {
 Jedis j = getShard(key);
 return j.srem(key, members);
}

代码示例来源:origin: caoxinyu/RedisClient

@Override
protected void command() {
  jedis.select(db);
  jedis.srem(key, values);
}

代码示例来源:origin: caoxinyu/RedisClient

@Override
protected void command() {
  jedis.select(db);
  for(String value: values)
    jedis.srem(key, value);
}

代码示例来源:origin: Netflix/conductor

@Override
public Long srem(String key, String... member) {
 Jedis jedis = null;
  try {
   jedis = jedisPool.getResource();
   return jedis.srem(key, member);
  } finally {
   if (jedis != null)
    jedis.close();
  }
}

代码示例来源:origin: shuzheng/zheng

Jedis jedis = RedisUtil.getJedis();
jedis.del(ZHENG_UPMS_CLIENT_SESSION_ID + "_" + sessionId);
jedis.srem(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code, sessionId);
jedis.close();
for (String clientSessionId : clientSessionIds) {
  jedis.del(ZHENG_UPMS_CLIENT_SESSION_ID + "_" + clientSessionId);
  jedis.srem(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code, clientSessionId);

代码示例来源:origin: jfinal/jfinal

/**
 * 移除集合 key 中的一个或多个 member 元素,不存在的 member 元素会被忽略。
 */
public Long srem(Object key, Object... members) {
  Jedis jedis = getJedis();
  try {
    return jedis.srem(keyToBytes(key), valuesToBytesArray(members));
  }
  finally {close(jedis);}
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Long sRem(byte[] key, byte[]... values) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(values, "Values must not be null!");
  Assert.noNullElements(values, "Values must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().srem(key, values)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().srem(key, values)));
      return null;
    }
    return connection.getJedis().srem(key, values);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: jwpttcg66/NettyGameServer

public void sremString(String key,String value){
  Jedis jedis = null;
  boolean sucess = true;
  try {
    jedis = jedisPool.getResource();
    jedis.srem(key, value);
  } catch (Exception e) {
    sucess = false;
    returnBrokenResource(jedis, "sremString"+key, e);
  } finally {
    if (sucess && jedis != null) {
      returnResource(jedis);
    }
  }
}

代码示例来源:origin: jwpttcg66/NettyGameServer

public void sremStrings(String key,String... values){
  Jedis jedis = null;
  boolean sucess = true;
  try {
    jedis = jedisPool.getResource();
    jedis.srem(key,values);
  } catch (Exception e) {
    sucess = false;
    returnBrokenResource(jedis, "sremStrings"+key, e);
  } finally {
    if (sucess && jedis != null) {
      returnResource(jedis);
    }
  }
}

代码示例来源:origin: foxinmy/weixin4j

@Override
public T evict(String key) {
  T cache = lookup(key);
  Jedis jedis = null;
  try {
    jedis = jedisPool.getResource();
    jedis.del(key);
    jedis.srem(ALLKEY, key);
  } finally {
    if (jedis != null) {
      jedis.close();
    }
  }
  return cache;
}

代码示例来源:origin: gresrun/jesque

/**
   * {@inheritDoc}
   */
  @Override
  public Void doWork(final Jedis jedis) throws Exception {
    jedis.srem(key(WORKERS), workerName);
    jedis.del(key(WORKER, workerName), key(WORKER, workerName, STARTED), 
        key(STAT, FAILED, workerName), key(STAT, PROCESSED, workerName));
    return null;
  }
});

代码示例来源:origin: gresrun/jesque

/**
   * {@inheritDoc}
   */
  @Override
  public Void doWork(final Jedis jedis) throws Exception {
    jedis.srem(key(QUEUES), name);
    jedis.del(key(QUEUE, name));
    return null;
  }
});

代码示例来源:origin: gresrun/jesque

/**
   * {@inheritDoc}
   */
  @Override
  public Void doWork(final Jedis jedis) {
    jedis.srem(key(WORKERS), name);
    jedis.del(key(WORKER, name), key(WORKER, name, STARTED), key(STAT, FAILED, name),
        key(STAT, PROCESSED, name));
    return null;
  }
});

代码示例来源:origin: lindzh/hasting

public Object callback(Jedis jedis) {
    //删除服务列表
    final String key = RedisUtils.genServicesKey(namespace, serverMd5);
    jedis.del(key);
    final HostAndPort andPort = new HostAndPort(network.getHost(), network.getPort());
    final String json = JSONUtils.toJSON(andPort);
    //删除host
    jedis.srem(namespace+"_"+RpcClusterConst.RPC_REDIS_HOSTS_KEY, json);
    return null;
  }
});

代码示例来源:origin: com.jfinal/jfinal

/**
 * 移除集合 key 中的一个或多个 member 元素,不存在的 member 元素会被忽略。
 */
public Long srem(Object key, Object... members) {
  Jedis jedis = getJedis();
  try {
    return jedis.srem(keyToBytes(key), valuesToBytesArray(members));
  }
  finally {close(jedis);}
}

代码示例来源:origin: yangfuhai/jboot

/**
 * 移除集合 key 中的一个或多个 member 元素,不存在的 member 元素会被忽略。
 */
public Long srem(Object key, Object... members) {
  Jedis jedis = getJedis();
  try {
    return jedis.srem(keyToBytes(key), valuesToBytesArray(members));
  } finally {
    returnResource(jedis);
  }
}

相关文章

Jedis类方法