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

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

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

JedisCluster.linsert介绍

暂无

代码示例

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

@Override
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().linsert(key, JedisConverters.toListPosition(where), pivot, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: net.oschina.j2cache/j2cache-core

@Override
public Long linsert(byte[] bytes, BinaryClient.LIST_POSITION list_position, byte[] bytes1, byte[] bytes2) {
  return cluster.linsert(bytes, list_position, bytes1, bytes2);
}

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

public Long linsert(String key, LIST_POSITION where, String pivot, String value) {
  return jedisCluster.linsert(key, where, pivot, value);
}

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

public Long linsert(byte[] key, LIST_POSITION where, byte[] pivot, byte[] value) {
  return jedisCluster.linsert(key, where, pivot, value);
}

代码示例来源:origin: hhfcyong/xxxx-dubbo

/**
 * 将值 value 插入到列表 key 当中,位于值 pivot 之前或之后
 * 当 pivot 不存在于列表 key 时,不执行任何操作
 * 当 key 不存在时, key 被视为空列表,不执行任何操作
 * 如果 key 不是列表类型,返回一个错误
 * @param key
 * @param where  值为BEFORE或者AFTER
 * @param pivot
 * @param value
 * @return 成功:返回list长度  无pivot:返回-1   key不存在或者空列表:返回0 where输入错误:返回-2
 */
public long linsert(String key,String where,String pivot,String value){
  long result=-2;
  if(where.toUpperCase()=="BEFORE"){
    result=jedisCluster.linsert(key,LIST_POSITION.BEFORE, pivot, value);
  }
  else if(where.toUpperCase()=="AFTER"){
    result=jedisCluster.linsert(key,LIST_POSITION.AFTER, pivot, value);
  }
  return result;
}
/**

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

@Override
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().linsert(key, JedisConverters.toListPosition(where), pivot, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().linsert(key, JedisConverters.toListPosition(where), pivot, value);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
public long linsert(final String key, final String pivot, final String value, final Mark position) {
  Assert.hasText(key);
  Assert.hasText(pivot);
  Assert.hasText(value);
  Assert.notNull(position);
  try {
    switch (position) {
      case BEFORE:
        return cluster.linsert(key, LIST_POSITION.BEFORE, pivot, value);
      case AFTER:
        return cluster.linsert(key, LIST_POSITION.AFTER, pivot, value);
      default:
        throw new RedisClientException("Unknown pivot type");
    }
  } catch (final Throwable e) {
    throw new RedisClientException(e.getMessage(), e);
  }
}

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

/**
 * 将值 value 插入到列表 key 当中,位于值 pivot 之前或之后。
 * 当 pivot 不存在于列表 key 时,不执行任何操作。
 * 当 key 不存在时, key 被视为空列表,不执行任何操作。
 * 如果 key 不是列表类型,返回一个错误。
 */
public Long linsert(Object key, LIST_POSITION where, Object pivot, Object obj) {
  if (null == key || null == pivot || null == obj) {
    return null;
  }
  if (cluster) {
    return jedisCluster.linsert(serializeKey(key), where, serializeVal(pivot), serializeVal(obj));
  } else {
    return jedisOperator.linsert(serializeKey(key), where, serializeVal(pivot), serializeVal(obj));
  }
}

相关文章

微信公众号

最新文章

更多

JedisCluster类方法