public class StringRedisSerializer extends Object implements RedisSerializer<String>
Useful when the interaction with the Redis happens mainly through Strings.
Does not perform any null conversion since empty strings are valid keys/values.
| Constructor and Description |
|---|
StringRedisSerializer()
Creates a new
StringRedisSerializer using UTF-8. |
StringRedisSerializer(Charset charset)
Creates a new
StringRedisSerializer using the given Charset to encode and decode strings. |
| Modifier and Type | Method and Description |
|---|---|
String |
deserialize(byte[] bytes)
Deserialize an object from the given binary data.
|
byte[] |
serialize(String string)
Serialize the given object to binary data.
|
public StringRedisSerializer()
StringRedisSerializer using UTF-8.public StringRedisSerializer(Charset charset)
StringRedisSerializer using the given Charset to encode and decode strings.charset - must not be null.public String deserialize(@Nullable byte[] bytes)
RedisSerializerdeserialize in interface RedisSerializer<String>bytes - object binary representation. Can be null.public byte[] serialize(@Nullable String string)
RedisSerializerserialize in interface RedisSerializer<String>string - object to serialize. Can be null.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.