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

x33g5p2x  于2022-01-26 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(399)

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

Pipeline.hset介绍

暂无

代码示例

代码示例来源:origin: signalapp/Signal-Server

public void add(BatchOperationHandle handle, ClientContact contact) {
 try {
  Pipeline   pipeline   = handle.pipeline;
  TokenValue tokenValue = new TokenValue(contact.getRelay(), contact.isVoice(), contact.isVideo());
  pipeline.hset(DIRECTORY_KEY, contact.getToken(), objectMapper.writeValueAsBytes(tokenValue));
 } catch (JsonProcessingException e) {
  logger.warn("JSON Serialization", e);
 }
}

代码示例来源:origin: apache/storm

pipeline.hset(additionalKey, key, value);
  break;
default:

代码示例来源:origin: qiujiayu/AutoLoadCache

@Override
public void hset(byte[] key, byte[] field, byte[] value, int seconds) {
  Jedis jedis = shardedJedis.getShard(key);
  Pipeline pipeline = jedis.pipelined();
  pipeline.hset(key, field, value);
  pipeline.expire(key, seconds);
  pipeline.sync();
}

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

@Override
public Boolean hSet(byte[] key, byte[] field, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(field, "Field must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().hset(key, field, value),
          JedisConverters.longToBoolean()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().hset(key, field, value),
          JedisConverters.longToBoolean()));
      return null;
    }
    return JedisConverters.toBoolean(connection.getJedis().hset(key, field, value));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
  Response<Long> execute(Pipeline jedisPipeline) throws DynoException {
    return jedisPipeline.hset(key, field, value);
  }
}.execute(key, OpName.HSET);

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

@Override
  Response<Long> execute(Pipeline jedisPipeline) throws DynoException {
    return jedisPipeline.hset(key, field, value);
  }
}.execute(key, OpName.HSET);

代码示例来源:origin: Netflix/dyno-queues

@Override
public void hset(String key, String field, String value) {
  pipe.hset(key, field, value);
  
}

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

@Override
public Response<Long> hset(byte[] key, byte[] field, byte[] value) {
 String command = "hset";
 return instrumented(command, payloadSize(value), () -> delegated.hset(key, field, value));
}

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

@Override
public Response<Long> hset(String key, String field, String value) {
 String command = "hset";
 return instrumented(command, payloadSize(value), () -> delegated.hset(key, field, value));
}

代码示例来源:origin: Baqend/Orestes-Bloomfilter

/**
   * Sets the value at the given position.
   *
   * @param position The position in the Bloom filter
   * @param value    The value to set
   * @param p        The jedis pipeline to use
   */
  private void set(int position, long value, Pipeline p) {
    bloom.set(p, position, value > 0);
    p.hset(keys.COUNTS_KEY.getBytes(), RedisUtils.encodeKey(position), RedisUtils.encodeValue(value));
  }
}

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

public Long execute(final Jedis conn) throws Exception {
    byte[] bk = SafeEncoder.encode(key);
    Pipeline pipe = conn.pipelined();
    for(String field : nums.keySet()){
      pipe.hset(bk, SafeEncoder.encode(field), SafeEncoder.encode(String.valueOf(nums.get(field))));
    }
    pipe.exec();
    return 1L;
  }
});

代码示例来源:origin: com.github.biezhi/unique-support-redis

@Override
  Long execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Long> result = pipeline.hset(key.getBytes(), field.getBytes(), SerializeUtil.serialize(value));
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

代码示例来源:origin: kstyrc/trident-redis

public void multiPut(List<List<Object>> keys, List<T> vals) {
 if (keys.size() == 0) {
   return;
 }
 if (Strings.isNullOrEmpty(this.options.hkey)) {
   String[] keyValues = buildKeyValuesList(keys, vals);
   mset(keyValues);
 } else {
   Jedis jedis = pool.getResource();
   try {
    Pipeline pl = jedis.pipelined();
    pl.multi();
    for (int i = 0; i < keys.size(); i++) {
      String val = new String(serializer.serialize(vals.get(i)));
      pl.hset(this.options.hkey,
         keyFactory.build(keys.get(i)),
         val);
    }
    pl.exec();
    pl.sync();
   } finally {
    pool.returnResource(jedis);
   }
 }
}

代码示例来源:origin: com.github.biezhi/unique-support-redis

@Override
  Long execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Long> result = pipeline.hset(key, field, value);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
public Boolean hSet(byte[] key, byte[] field, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(field, "Field must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().hset(key, field, value),
          JedisConverters.longToBoolean()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().hset(key, field, value),
          JedisConverters.longToBoolean()));
      return null;
    }
    return JedisConverters.toBoolean(connection.getJedis().hset(key, field, value));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
public Boolean hSet(byte[] key, byte[] field, byte[] value) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(field, "Field must not be null!");
  Assert.notNull(value, "Value must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().hset(key, field, value),
          JedisConverters.longToBoolean()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().hset(key, field, value),
          JedisConverters.longToBoolean()));
      return null;
    }
    return JedisConverters.toBoolean(connection.getJedis().hset(key, field, value));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

相关文章

Pipeline类方法