Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring Data

You're reading from  Spring Data

Product type Book
Published in Nov 2012
Publisher Packt
ISBN-13 9781849519045
Pages 160 pages
Edition 1st Edition
Languages
Author (1):
Petri Kainulainen Petri Kainulainen
Profile icon Petri Kainulainen
Toc

Using Spring cache abstraction with Spring Data Redis


The cache abstraction of Spring Framework 3.1 applies caching to Java methods. When a cached method is called, the cache abstraction will check from the cache if the method has been called earlier by using the same parameters. If this is the case, then the return value is fetched from the cache and the method is not executed. Otherwise, the method is executed and its return value is stored in the cache.

Note

The cache abstraction of Spring Framework 3.1 is explained in more detail at http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/cache.html.

Spring Data Redis provides an implementation of the Spring cache abstraction. Using Redis as a cache has two benefits over using local caching implementations such as Ehcache:

  • It can be used as a centralized cache that is shared by each servlet container or application server that runs our application. This reduces the overall number of database queries, which reduces...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}