Interface RedisSerializationContext<K,V>
public interface RedisSerializationContext<K,V>
Serialization context for reactive use.
This context provides RedisSerializationContext.SerializationPair
s for key, value, hash-key (field), hash-value and String
serialization and deserialization.
- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl, John Blum
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Builder forRedisSerializationContext
.static interface
Typed serialization tuple. -
Method Summary
Modifier and TypeMethodDescriptionstatic RedisSerializationContext<byte[],
byte[]> Creates a newRedisSerializationContext
using abyte[]
serialization.Creates a newRedisSerializationContext
using aByteBuffer
serialization.static <T> RedisSerializationContext<T,
T> fromSerializer
(RedisSerializer<T> serializer) Creates a newRedisSerializationContext
using the givenRedisSerializer
.static RedisSerializationContext<Object,
Object> java()
Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
.static RedisSerializationContext<Object,
Object> java
(ClassLoader classLoader) Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
with givenClassLoader
to resolvestype
of the keys and values stored in Redis.static <T> RedisSerializationContext<T,
T> just
(RedisSerializationContext.SerializationPair<T> serializationPair) Creates a newRedisSerializationContext
using the givenRedisSerializationContext.SerializationPair
.static <K,
V> RedisSerializationContext.RedisSerializationContextBuilder<K, V> Creates a newRedisSerializationContext.RedisSerializationContextBuilder
.static <K,
V> RedisSerializationContext.RedisSerializationContextBuilder<K, V> newSerializationContext
(RedisSerializationContext.SerializationPair<?> serializationPair) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializationContext.SerializationPair
.static <K,
V> RedisSerializationContext.RedisSerializationContextBuilder<K, V> newSerializationContext
(RedisSerializer<?> defaultSerializer) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializer
.static RedisSerializationContext<byte[],
byte[]> raw()
Deprecated.since 2.2.static RedisSerializationContext<String,
String> string()
Creates a newRedisSerializationContext
using aStringRedisSerializer
.
-
Method Details
-
newSerializationContext
static <K,V> RedisSerializationContext.RedisSerializationContextBuilder<K,V> newSerializationContext()Creates a newRedisSerializationContext.RedisSerializationContextBuilder
.- Type Parameters:
K
- expected key type.V
- expected value type.- Returns:
- a new
RedisSerializationContext.RedisSerializationContextBuilder
.
-
newSerializationContext
static <K,V> RedisSerializationContext.RedisSerializationContextBuilder<K,V> newSerializationContext(RedisSerializer<?> defaultSerializer) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializer
.- Type Parameters:
K
- expected key type.V
- expected value type.- Parameters:
defaultSerializer
- must not be null.- Returns:
- a new
RedisSerializationContext.RedisSerializationContextBuilder
.
-
newSerializationContext
static <K,V> RedisSerializationContext.RedisSerializationContextBuilder<K,V> newSerializationContext(RedisSerializationContext.SerializationPair<?> serializationPair) Creates a newRedisSerializationContext.RedisSerializationContextBuilder
using a given defaultRedisSerializationContext.SerializationPair
.- Type Parameters:
K
- expected key type.V
- expected value type.- Parameters:
serializationPair
- must not be null.- Returns:
- a new
RedisSerializationContext.RedisSerializationContextBuilder
.
-
raw
Deprecated.since 2.2. Please usebyteArray()
instead.Creates a newRedisSerializationContext
using abyte[]
serialization pair.- Returns:
- new instance of
RedisSerializationContext
.
-
byteArray
Creates a newRedisSerializationContext
using abyte[]
serialization.- Returns:
- new instance of
RedisSerializationContext
. - Since:
- 2.2
-
byteBuffer
Creates a newRedisSerializationContext
using aByteBuffer
serialization.- Returns:
- new instance of
RedisSerializationContext
. - Since:
- 2.2
-
java
Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
.- Returns:
- a new
RedisSerializationContext
using JDK Serializaton. - Since:
- 2.1
-
java
Creates a newRedisSerializationContext
using aJdkSerializationRedisSerializer
with givenClassLoader
to resolvestype
of the keys and values stored in Redis.- Parameters:
classLoader
-ClassLoader
used to resolvetypes
of keys and value stored in Redis during deserialization; can be null.- Returns:
- a new
RedisSerializationContext
using JDK Serializaton. - Since:
- 2.1
-
string
Creates a newRedisSerializationContext
using aStringRedisSerializer
.- Returns:
- a new
RedisSerializationContext
using aStringRedisSerializer
.
-
fromSerializer
Creates a newRedisSerializationContext
using the givenRedisSerializer
.- Type Parameters:
T
-Type
ofObject
being de/serialized by theRedisSerializer
.- Parameters:
serializer
-RedisSerializer
used to de/serialize keys and value stored in Redis; must not be null.- Returns:
- a new
RedisSerializationContext
using the givenRedisSerializer
.
-
just
static <T> RedisSerializationContext<T,T> just(RedisSerializationContext.SerializationPair<T> serializationPair) Creates a newRedisSerializationContext
using the givenRedisSerializationContext.SerializationPair
.- Type Parameters:
T
-Type
ofObject
de/serialized by theRedisSerializationContext.SerializationPair
.- Parameters:
serializationPair
-RedisSerializationContext.SerializationPair
used to de/serialize keys and values stored in Redis; must not be null.- Returns:
- a new
RedisSerializationContext
using the givenRedisSerializationContext.SerializationPair
.
-
getKeySerializationPair
RedisSerializationContext.SerializationPair<K> getKeySerializationPair()- Returns:
RedisSerializationContext.SerializationPair
for key-typed serialization and deserialization.
-
getValueSerializationPair
RedisSerializationContext.SerializationPair<V> getValueSerializationPair()- Returns:
RedisSerializationContext.SerializationPair
for value-typed serialization and deserialization.
-
getHashKeySerializationPair
- Returns:
RedisSerializationContext.SerializationPair
for hash-key-typed serialization and deserialization.
-
getHashValueSerializationPair
- Returns:
RedisSerializationContext.SerializationPair
for hash-value-typed serialization and deserialization.
-
getStringSerializationPair
RedisSerializationContext.SerializationPair<String> getStringSerializationPair()- Returns:
RedisSerializationContext.SerializationPair
forString
-typed serialization and deserialization.
-