Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Difference between CrudRepository and RedisTemplate's HashOperations

$
0
0

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 Users 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()


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>