Posts

Showing posts from December, 2014

Cache using @Cacheable annotation in Spring itself......

Spring 3.1 Provides Cache using @Cacheable annotation.. Methods for whom the result is stored into the cache so on subsequent invocations (with the same arguments), the value in the cache is returned without having to actually execute the method. In its simplest form, the annotation declaration requires the name of the cache associated with the annotated method: @Cacheable("books") public Book findBook(ISBN isbn) {...} Just like other services in the Spring Framework, the caching service is an abstraction (not a cache implementation) and requires the use of an actual storage to store the cache data - that is, the abstraction frees the developer from having to write the caching logic but does not provide the actual stores. This abstraction is materialized by the  org.springframework.cache.Cache  and  org.springframework.cache.CacheManager  interfaces. There are  a few implementations  of that abstraction available out of the box: JDK ...