Related Documentation : Integrations : Using Ehcache with Spring : Using Spring 3.1
Using Spring 3.1
Ehcache has had excellent Spring integration for years. Spring 3.1 includes an Ehcache implementation. See the Spring 3.1 JavaDoc.
Spring Framework 3.1 has a generic cache abstraction for transparently applying caching to Spring applications. It has caching support for classes and methods using two annotations:
@Cacheable
Cache a method call. In the following example, the value is the return type, a Manual. The key is extracted from the ISBN argument using the id.
@Cacheable(value="manual", key="#isbn.id")
public Manual findManual(ISBN isbn, boolean checkWarehouse)
@CacheEvict
Clears the cache when called.
@CacheEvict(value = "manuals", allEntries=true)
public void loadManuals(InputStream batch)
Copyright © 2014 Software AG, Darmstadt, Germany.

Product Logo |   Feedback