Spring Framework provides a comprehensive abstraction for common caching scenarios without coupling to any of supported cache implementations.
However, declaration of expiration time for a particular storage is not a part of this abstraction.
For example, if you updated a user, you would want to place the result into the cache to be looked up later: This method will always be executed and its results stored in your cache.
With Spring and Redis we will try to build simple app and consider how different factors can impact on our caching layer. Lets imagine that you work with social site where users are able to create own content, top most read posts are good candidates to find place in cache.Now, before we start configuring anything, we have to add a dependency.Spring by itself only provides a caching abstraction.Caching is a very common operation when developing applications.Spring made a neat abstraction layer on top of the different caching providers (Ehcache, Caffeine, Guava, Gem Fire, …).