@Override public Mono<Long> append(K key, String value) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(value, "Value must not be null!"); return createMono( connection -> connection.append(rawKey(key), serializationContext.getStringSerializationPair().write(value))); }
@SuppressWarnings("unchecked") private ByteBuffer rawHashKey(HK key) { try { return serializationContext.getHashKeySerializationPair().write(key); } catch (IllegalStateException e) {} return ByteBuffer.wrap(objectMapper.getConversionService().convert(key, byte[].class)); }
@SuppressWarnings("unchecked") private ByteBuffer rawValue(HV value) { try { return serializationContext.getHashValueSerializationPair().write(value); } catch (IllegalStateException e) {} return ByteBuffer.wrap(objectMapper.getConversionService().convert(value, byte[].class)); }
private ByteBuffer rawValue(V value) { return serializationContext.getValueSerializationPair().write(value); }
private ByteBuffer rawKey(K key) { return serializationContext.getKeySerializationPair().write(key); }
private ByteBuffer rawHashValue(HV key) { return serializationContext.getHashValueSerializationPair().write(key); }
private ByteBuffer rawHashKey(HK key) { return serializationContext.getHashKeySerializationPair().write(key); }
private ByteBuffer rawKey(K key) { return serializationContext.getKeySerializationPair().write(key); }
private ByteBuffer rawKey(H key) { return serializationContext.getKeySerializationPair().write(key); }
private ByteBuffer rawKey(K key) { return serializationContext.getKeySerializationPair().write(key); }
private ByteBuffer rawKey(K key) { return serializationContext.getKeySerializationPair().write(key); }
private ByteBuffer rawValue(V value) { return serializationContext.getValueSerializationPair().write(value); }
private ByteBuffer rawValue(V value) { return serializationContext.getValueSerializationPair().write(value); }
private ByteBuffer rawKey(K key) { return serializationContext.getKeySerializationPair().write(key); }
private ByteBuffer rawValue(V value) { return serializationContext.getValueSerializationPair().write(value); }
private ByteBuffer rawKey(K key) { return serializationContext.getKeySerializationPair().write(key); }
private ByteBuffer rawValue(V value) { return serializationContext.getValueSerializationPair().write(value); } }
/** * Serialize the value to cache. * * @param value must not be {@literal null}. * @return never {@literal null}. */ protected byte[] serializeCacheValue(Object value) { if (isAllowNullValues() && value instanceof NullValue) { return BINARY_NULL_VALUE; } return ByteUtils.getBytes(cacheConfig.getValueSerializationPair().write(value)); }
/** * Serialize the key. * * @param cacheKey must not be {@literal null}. * @return never {@literal null}. */ protected byte[] serializeCacheKey(String cacheKey) { return ByteUtils.getBytes(cacheConfig.getKeySerializationPair().write(cacheKey)); }
@Override public Mono<Long> convertAndSend(String destination, V message) { Assert.hasText(destination, "Destination channel must not be empty!"); Assert.notNull(message, "Message must not be null!"); return createMono(connection -> connection.pubSubCommands().publish( getSerializationContext().getStringSerializationPair().write(destination), getSerializationContext().getValueSerializationPair().write(message))); }