Spring Boot Caching With Redis

    Question 1SPRING BOOT CACHING- Enabling Caching

    Which annotation is used to enable caching in a Spring Boot application?

    Question 2SPRING BOOT CACHING- Cacheable Annotation

    What does the @Cacheable annotation do?

    Question 3SPRING BOOT CACHING- Code Snippet (@Cacheable)

    What does this method do?

    @Cacheable("users") public User findUserById(Long id) { return userRepository.findById(id).orElseThrow(); }

    Question 4SPRING BOOT CACHING- CacheEvict Annotation

    What is the purpose of @CacheEvict?

    Question 5SPRING BOOT CACHING- Code Snippet (@CacheEvict)

    What does this method do?

    @CacheEvict(value = "users", key = "#id") public void deleteUser(Long id) { userRepository.deleteById(id); }

    Question 6SPRING BOOT CACHING- Redis as Cache Store

    How does Spring Boot typically connect to Redis for caching?

    Question 7SPRING BOOT CACHING- Code Snippet (CachePut)

    What does this annotation do?

    @CachePut(value = "users", key = "#user.id") public User updateUser(User user) { return userRepository.save(user); }

    Question 8SPRING BOOT CACHING- CacheManager Bean

    Which bean typically manages cache interactions in a Redis-backed Spring Boot application?

    Question 9SPRING BOOT CACHING- TTL in Redis Cache

    How can you configure a Time-To-Live (TTL) for cached entries in Spring Boot Redis caching?

    Question 10SPRING BOOT CACHING- Code Snippet (RedisTemplate Usage)

    What does this code do?

    @Autowired private RedisTemplate<String, String> redisTemplate; @Test void testSetAndGet() { redisTemplate.opsForValue().set("greeting", "Hello Redis"); String value = redisTemplate.opsForValue().get("greeting"); System.out.println(value); }