So, I started learning Redis and I am using Spring Boot Data Redis as shown in this article. When I call the findAll
method of UserRepository
it returns all the User
s saved via the save
method of UserRepository
but when I use the HashOperations
object to get all the Hashes it returns only the User
hashes which are put into redis via the HashOperations
object. I am creating the HashOperations
object in the UserController
(API) as shown below.
private RedisTemplate redisTemplate;private HashOperations<String, Long, Order> hashOperations;public UserController(final UserService userService, final RedisTemplate redisTemplate) { this.userService = userService; this.redisTemplate = redisTemplate; this.hashOperations = redisTemplate.opsForHash();}
So, I want to know what the difference is or why does it return different results when I call the hashOperations.entries("users")
and userService .findAll()