DATAREDIS-764 - Fix code quotation and mention default serializers.

Original Pull Request: #305
This commit is contained in:
Mark Paluch
2018-01-30 12:50:34 +01:00
committed by Christoph Strobl
parent afbd5b1e4d
commit e499dcfdaa

View File

@@ -62,7 +62,7 @@ class AppConfig {
There are also a few Lettuce-specific connection parameters that can be tweaked. By default, all `LettuceConnection` s created by the `LettuceConnectionFactory` share the same thread-safe native connection for all non-blocking and non-transactional operations. Set `shareNativeConnection` to false to use a dedicated connection each time. `LettuceConnectionFactory` can also be configured with a `LettucePool` to use for pooling blocking and transactional connections, or all connections if `shareNativeConnection` is set to false.
Lettuce integrates with netty's http://netty.io/wiki/native-transports.html[native transports] allowing to use unix domain sockets to communicate with Redis. Make sure to include the appropriate native transport dependencies that match your runtime environment.
[source,java]
----
@Configuration
@@ -339,20 +339,22 @@ The conversion between the user (custom) types and raw data (and vice-versa) is
This package contains two types of serializers which as the name implies, takes care of the serialization process:
* Two-way serializers based on`RedisSerializer`.
* Element readers and writers using `RedisElementReader` and `RedisElementWriter`.
* Two-way serializers based on ``RedisSerializer``.
* Element readers and writers using `RedisElementReader` and ``RedisElementWriter``.
The main difference between these variants is that `RedisSerializer` primarily serializes to `byte[]` while readers and writers use `ByteBuffer`.
Multiple implementations are available out of the box, two of which have been already mentioned before in this documentation:
* the `StringRedisSerializer`
* `JdkSerializationRedisSerializer`
* `JdkSerializationRedisSerializer` which is used by default for `RedisCache` and ``RedisTemplate``.
* the ``StringRedisSerializer``.
However one can use `OxmSerializer` for Object/XML mapping through Spring http://docs.spring.io/spring/docs/{springVersion}/spring-framework-reference/data-access.html#oxm[OXM] support or either `Jackson2JsonRedisSerializer` or `GenericJackson2JsonRedisSerializer` for storing data in http://en.wikipedia.org/wiki/JSON[JSON] format.
Do note that the storage format is not limited only to values - it can be used for keys, values or hashes without any restrictions.
WARNING: `RedisCache` and `RedisTemplate` are configured by default to use Java native serialization. Java native serialization is known for allowing remote code execution caused by payloads that exploit vulnerable libraries and classes injecting unverified bytecode. You might want to consider other serialization mechanisms such as JSON or XML to prevent flaws. Alternatively, use a customized `ObjectInputStream` whitelisting classes you trust to be deserialized properly. See also https://www.owasp.org/index.php/Deserialization_of_untrusted_data[OWASP: Deserialization of untrusted data].
[[redis.hashmappers.root]]
== Hash mapping