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

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

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

JedisCluster.brpoplpush介绍

暂无

代码示例

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

@Override
public byte[] bRPopLPush(int timeout, 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().brpoplpush(srcKey, dstKey, timeout);
    } catch (Exception ex) {
      throw convertJedisAccessException(ex);
    }
  }
  List<byte[]> val = bRPop(timeout, srcKey);
  if (!CollectionUtils.isEmpty(val)) {
    lPush(dstKey, val.get(1));
    return val.get(1);
  }
  return null;
}

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

public String brpoplpush(String source, String destination, int timeout) {
  return jedisCluster.brpoplpush(source, destination, timeout);
}

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

public byte[] brpoplpush(byte[] source, byte[] destination, int timeout) {
  return jedisCluster.brpoplpush(source, destination, timeout);
}

代码示例来源:origin: org.nanoframework/nano-orm-jedis

@Override
public String brpoplpush(final String source, final String destination, final int timeout) {
  Assert.hasText(source);
  Assert.hasText(destination);
  try {
    return cluster.brpoplpush(source, destination, timeout);
  } catch (final Throwable e) {
    throw new RedisClientException(e.getMessage(), e);
  }
}

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

@Override
public byte[] bRPopLPush(int timeout, 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().brpoplpush(srcKey, dstKey, timeout);
    } catch (Exception ex) {
      throw convertJedisAccessException(ex);
    }
  }
  List<byte[]> val = bRPop(timeout, srcKey);
  if (!CollectionUtils.isEmpty(val)) {
    lPush(dstKey, val.get(1));
    return val.get(1);
  }
  return null;
}

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

@Override
public byte[] bRPopLPush(int timeout, 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().brpoplpush(srcKey, dstKey, timeout);
    } catch (Exception ex) {
      throw convertJedisAccessException(ex);
    }
  }
  List<byte[]> val = bRPop(timeout, srcKey);
  if (!CollectionUtils.isEmpty(val)) {
    lPush(dstKey, val.get(1));
    return val.get(1);
  }
  return null;
}

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

/**
 * 是 rpoplpush 的阻塞版本,当给定列表 source 不为空时, BRPOPLPUSH 的表现和 RPOPLPUSH 一样
 * 
 * @param srcKey
 * @param dstKey
 * @param timeout
 * @return
 */
public byte[] brpoplpush(Object srcKey, Object dstKey, int timeout) {
  if (null == srcKey || null == dstKey) {
    return null;
  }
  if (cluster) {
    return jedisCluster.brpoplpush(serializeKey(srcKey), serializeKey(dstKey), timeout);
  } else {
    return jedisOperator.brpoplpush(serializeKey(srcKey), serializeKey(dstKey), timeout);
  }
}

相关文章

微信公众号

最新文章

更多

JedisCluster类方法