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); } }
pipeline.hset(additionalKey, key, value); break; default:
@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(); }
@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); } }
@Override Response<Long> execute(Pipeline jedisPipeline) throws DynoException { return jedisPipeline.hset(key, field, value); } }.execute(key, OpName.HSET);
@Override Response<Long> execute(Pipeline jedisPipeline) throws DynoException { return jedisPipeline.hset(key, field, value); } }.execute(key, OpName.HSET);
@Override public void hset(String key, String field, String value) { pipe.hset(key, field, value); }
@Override public Response<Long> hset(byte[] key, byte[] field, byte[] value) { String command = "hset"; return instrumented(command, payloadSize(value), () -> delegated.hset(key, field, value)); }
@Override public Response<Long> hset(String key, String field, String value) { String command = "hset"; return instrumented(command, payloadSize(value), () -> delegated.hset(key, field, value)); }
/** * 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)); } }
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; } });
@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();
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); } } }
@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();
@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); } }
@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); } }