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

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

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

JedisCluster.rpoplpush介绍

暂无

代码示例

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

@Override
public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) {
  Assert.notNull(srcKey, "Source key must not be null!");
  Assert.notNull(dstKey, "Destination key must not be null!");
  if (ClusterSlotHashUtil.isSameSlotForAllKeys(srcKey, dstKey)) {
    try {
      return connection.getCluster().rpoplpush(srcKey, dstKey);
    } catch (Exception ex) {
      throw convertJedisAccessException(ex);
    }
  }
  byte[] val = rPop(srcKey);
  lPush(dstKey, val);
  return val;
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

public String rpoplpush(String srckey, String dstkey) {
  return jedisCluster.rpoplpush(srckey, dstkey);
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

public byte[] rpoplpush(byte[] srckey, byte[] dstkey) {
  return jedisCluster.rpoplpush(srckey, dstkey);
}

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

/**
 * 命令 RPOPLPUSH 在一个原子时间内,执行以下两个动作:
 * 将列表 source 中的最后一个元素(尾元素)弹出,并返回给客户端。
 * 将 source 弹出的元素插入到列表 destination ,作为 destination 列表的的头元素。
 */
@SuppressWarnings("unchecked")
public <T> T rpoplpush(Object srcKey, Object dstKey) {
  return (T) valueFromBytes(jedisCluster.rpoplpush(keyToBytes(srcKey), keyToBytes(dstKey)));
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) {
  Assert.notNull(srcKey, "Source key must not be null!");
  Assert.notNull(dstKey, "Destination key must not be null!");
  if (ClusterSlotHashUtil.isSameSlotForAllKeys(srcKey, dstKey)) {
    try {
      return connection.getCluster().rpoplpush(srcKey, dstKey);
    } catch (Exception ex) {
      throw convertJedisAccessException(ex);
    }
  }
  byte[] val = rPop(srcKey);
  lPush(dstKey, val);
  return val;
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) {
  Assert.notNull(srcKey, "Source key must not be null!");
  Assert.notNull(dstKey, "Destination key must not be null!");
  if (ClusterSlotHashUtil.isSameSlotForAllKeys(srcKey, dstKey)) {
    try {
      return connection.getCluster().rpoplpush(srcKey, dstKey);
    } catch (Exception ex) {
      throw convertJedisAccessException(ex);
    }
  }
  byte[] val = rPop(srcKey);
  lPush(dstKey, val);
  return val;
}

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

/**
 * 一个原子时间内,执行以下两个动作:
 * 将列表 source 中的最后一个元素(尾元素)弹出,并返回给客户端
 * 将 source 弹出的元素插入到列表 destination ,作为 destination 列表的的头元素
 * 
 * @param srcKey
 * @param dstKey
 * @return
 */
public byte[] rpoplpush(Object srcKey, Object dstKey) {
  if (null == srcKey || null == dstKey) {
    return null;
  }
  if (cluster) {
    return jedisCluster.rpoplpush(serializeKey(srcKey), serializeKey(dstKey));
  } else {
    return jedisOperator.rpoplpush(serializeKey(srcKey), serializeKey(dstKey));
  }
}

相关文章

微信公众号

最新文章

更多

JedisCluster类方法