O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Caching

In order to improve the performance of an application, caching heavy operations is inevitable. Spring 3.1 added a great abstraction layer called caching that helped to abandon all custom-implemented aspects, decorators, and code injected into the business logic related to caching. 

Spring applies caching to the methods of Spring beans using AOP concepts; we learned about it in the AOP concepts section of this chapter. Spring creates proxies of the Spring beans where the methods are annotated to be cached. 

In order to leverage the benefits of Spring's caching abstraction layer, just annotate heavy methods with @Cacheable. Also, we need to notify our application that methods are cached by annotating our configuration class with @EnableCaching ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required