How it works...
For Spring Data Redis, the first instance you should create is the RedisTemplate, which will be used for Redis data manipulation. Before the RedisTemplate is instantiated, a JedisConnectionFactory is needed for the settings of the host and the port of Redis. For more reliable connection management, we also enabled the connection pool of the Redis clients.
After getting the RedisTemplate instance, we set the serializer of the key, hash key, and hash value respectively. For the key and hash key of the hash data in this demo, we just use plain text. For the hash value, the JSON format is used for better data organization.
Since we have prepared the RedisTemplate instance and its related settings, we can use it to implement the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access