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

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

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

Jedis.rpop介绍

[英]Atomically return and remove the first (LPOP) or last (RPOP) element of the list. For example if the list contains the elements "a","b","c" RPOP will return "c" and the list will become "a","b".

If the key does not exist or the list is already empty the special value 'nil' is returned.
[中]以原子方式返回并删除列表的第一个(LPOP)或最后一个(RPOP)元素。例如,如果列表包含元素“a”、“b”、“c”,RPOP将返回“c”,列表将变为“a”、“b”。
如果键不存在或列表已为空,则返回特殊值“nil”。

代码示例

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

@Override
 public byte[] execute(Jedis connection) {
  return connection.rpop(key);
 }
}.runBinary(key);

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

@Override
 public String execute(Jedis connection) {
  return connection.rpop(key);
 }
}.run(key);

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

public byte[] execute(Jedis connection) {
    return connection.rpop(keyByte);
  }
}.runBinary(keyByte);

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

@Override
public byte[] rpop(byte[] key) {
 Jedis j = getShard(key);
 return j.rpop(key);
}

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

@Override
public String rpop(String key) {
 Jedis j = getShard(key);
 return j.rpop(key);
}

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

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

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

@Override
protected void command() {
  jedis.select(db);
  if(headTail){
    jedis.lpop(key);
  } else {
    jedis.rpop(key);
  }
}

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

/**
 * 移除并返回列表 key 的尾元素。
 */
@SuppressWarnings("unchecked")
public <T> T rpop(Object key) {
  Jedis jedis = getJedis();
  try {
    return (T)valueFromBytes(jedis.rpop(keyToBytes(key)));
  }
  finally {close(jedis);}
}

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

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

代码示例来源:origin: yrain/smart-cache

@Override
  byte[] doInJedis(Jedis jedis) {
    return jedis.rpop(key);
  }
});

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public String rpop(String key) {
 String command = "rpop";
 return instrumented(command, () -> delegated.rpop(key));
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public byte[] rpop(byte[] key) {
 String command = "rpop";
 return instrumented(command, () -> delegated.rpop(key));
}

代码示例来源:origin: JFanZhao/spider

public String poll(String key){
    Jedis resource = jedisPool.getResource();
    String result = resource.rpop(key);
    jedisPool.returnResourceObject(resource);
    return result;
  }
}

代码示例来源:origin: com.github.yamingd.argo/argo-redis

public List<String> execute(final Jedis conn) throws Exception {
    byte[] bk = SafeEncoder.encode(key);
    List<String> resp = new ArrayList<String>();
    for (int i = 0; i < limit; i++) {
      byte[] bs = conn.rpop(bk);
      if (bs != null){
        resp.add(SafeEncoder.encode(bs));
      }
    }
    return resp;
  }
});

代码示例来源:origin: com.github.yamingd.argo/argo-redis

public List<T> execute(final Jedis conn) throws Exception {
    byte[] bk = SafeEncoder.encode(key);
    List<T> resp = new ArrayList<T>();
    for (int i = 0; i < limit; i++) {
      byte[] bs = conn.rpop(bk);
      if (bs != null){
        resp.add(getRedisBuffer().read(bs, clazz));
      }
    }
    return resp;
  }
});

代码示例来源:origin: com.github.yamingd.argo/argo-redis

public String execute(final Jedis conn) throws Exception {
    byte[] bs = conn.rpop(SafeEncoder.encode(key));
    if (bs == null){
      return null;
    }
    return SafeEncoder.encode(bs);
  }
});

代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence

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

代码示例来源:origin: com.github.yamingd.argo/argo-redis

public T execute(final Jedis conn) throws Exception {
    byte[] bs = conn.rpop(SafeEncoder.encode(key));
    if (bs == null){
      return null;
    }
    return getRedisBuffer().read(bs, clazz);
  }
});

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

/**
 * 移除并返回列表 key 的尾元素。
 */
@SuppressWarnings("unchecked")
public <T> T rpop(Object key) {
  Jedis jedis = getJedis();
  try {
    return (T) valueFromBytes(jedis.rpop(keyToBytes(key)));
  } finally {
    returnResource(jedis);
  }
}

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

/**
 * 移除并返回列表 key 的尾元素。
 */
@SuppressWarnings("unchecked")
public <T> T rpop(Object key) {
  Jedis jedis = getJedis();
  try {
    return (T)valueFromBytes(jedis.rpop(keyToBytes(key)));
  }
  finally {close(jedis);}
}

相关文章

微信公众号

最新文章

更多

Jedis类方法