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

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

本文整理了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

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

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

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

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

  1. @Override
  2. public void hset(byte[] key, byte[] field, byte[] value, int seconds) {
  3. Jedis jedis = shardedJedis.getShard(key);
  4. Pipeline pipeline = jedis.pipelined();
  5. pipeline.hset(key, field, value);
  6. pipeline.expire(key, seconds);
  7. pipeline.sync();
  8. }

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

  1. @Override
  2. public Boolean hSet(byte[] key, byte[] field, byte[] value) {
  3. Assert.notNull(key, "Key must not be null!");
  4. Assert.notNull(field, "Field must not be null!");
  5. Assert.notNull(value, "Value must not be null!");
  6. try {
  7. if (isPipelined()) {
  8. pipeline(connection.newJedisResult(connection.getRequiredPipeline().hset(key, field, value),
  9. JedisConverters.longToBoolean()));
  10. return null;
  11. }
  12. if (isQueueing()) {
  13. transaction(connection.newJedisResult(connection.getRequiredTransaction().hset(key, field, value),
  14. JedisConverters.longToBoolean()));
  15. return null;
  16. }
  17. return JedisConverters.toBoolean(connection.getJedis().hset(key, field, value));
  18. } catch (Exception ex) {
  19. throw convertJedisAccessException(ex);
  20. }
  21. }

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Sets the value at the given position.
  3. *
  4. * @param position The position in the Bloom filter
  5. * @param value The value to set
  6. * @param p The jedis pipeline to use
  7. */
  8. private void set(int position, long value, Pipeline p) {
  9. bloom.set(p, position, value > 0);
  10. p.hset(keys.COUNTS_KEY.getBytes(), RedisUtils.encodeKey(position), RedisUtils.encodeValue(value));
  11. }
  12. }

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

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

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

  1. @Override
  2. Long execute() {
  3. Pipeline pipeline = jedis.getShard(key).pipelined();
  4. Response<Long> result = pipeline.hset(key.getBytes(), field.getBytes(), SerializeUtil.serialize(value));
  5. pipeline.expire(key, expire);
  6. pipeline.sync();
  7. return result.get();
  8. }
  9. }.getResult();

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

  1. public void multiPut(List<List<Object>> keys, List<T> vals) {
  2. if (keys.size() == 0) {
  3. return;
  4. }
  5. if (Strings.isNullOrEmpty(this.options.hkey)) {
  6. String[] keyValues = buildKeyValuesList(keys, vals);
  7. mset(keyValues);
  8. } else {
  9. Jedis jedis = pool.getResource();
  10. try {
  11. Pipeline pl = jedis.pipelined();
  12. pl.multi();
  13. for (int i = 0; i < keys.size(); i++) {
  14. String val = new String(serializer.serialize(vals.get(i)));
  15. pl.hset(this.options.hkey,
  16. keyFactory.build(keys.get(i)),
  17. val);
  18. }
  19. pl.exec();
  20. pl.sync();
  21. } finally {
  22. pool.returnResource(jedis);
  23. }
  24. }
  25. }

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

  1. @Override
  2. Long execute() {
  3. Pipeline pipeline = jedis.getShard(key).pipelined();
  4. Response<Long> result = pipeline.hset(key, field, value);
  5. pipeline.expire(key, expire);
  6. pipeline.sync();
  7. return result.get();
  8. }
  9. }.getResult();

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

  1. @Override
  2. public Boolean hSet(byte[] key, byte[] field, byte[] value) {
  3. Assert.notNull(key, "Key must not be null!");
  4. Assert.notNull(field, "Field must not be null!");
  5. Assert.notNull(value, "Value must not be null!");
  6. try {
  7. if (isPipelined()) {
  8. pipeline(connection.newJedisResult(connection.getRequiredPipeline().hset(key, field, value),
  9. JedisConverters.longToBoolean()));
  10. return null;
  11. }
  12. if (isQueueing()) {
  13. transaction(connection.newJedisResult(connection.getRequiredTransaction().hset(key, field, value),
  14. JedisConverters.longToBoolean()));
  15. return null;
  16. }
  17. return JedisConverters.toBoolean(connection.getJedis().hset(key, field, value));
  18. } catch (Exception ex) {
  19. throw convertJedisAccessException(ex);
  20. }
  21. }

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

  1. @Override
  2. public Boolean hSet(byte[] key, byte[] field, byte[] value) {
  3. Assert.notNull(key, "Key must not be null!");
  4. Assert.notNull(field, "Field must not be null!");
  5. Assert.notNull(value, "Value must not be null!");
  6. try {
  7. if (isPipelined()) {
  8. pipeline(connection.newJedisResult(connection.getRequiredPipeline().hset(key, field, value),
  9. JedisConverters.longToBoolean()));
  10. return null;
  11. }
  12. if (isQueueing()) {
  13. transaction(connection.newJedisResult(connection.getRequiredTransaction().hset(key, field, value),
  14. JedisConverters.longToBoolean()));
  15. return null;
  16. }
  17. return JedisConverters.toBoolean(connection.getJedis().hset(key, field, value));
  18. } catch (Exception ex) {
  19. throw convertJedisAccessException(ex);
  20. }
  21. }

相关文章

Pipeline类方法