We are pleased to announce that Wanghy-Cache is now part of Spring Modules. We are stopping the development of Wanghy-Cache to continue under the umbrella of Spring Modules.


Wanghy-Cache provides declarative caching services to the Spring Framework.


  • Declarative caching services are enabled by Spring AOP.

    Wanghy-Cache provides two advises:

    1. org.wanghy.cache.interceptor.caching.CachingInterceptor.

      Stores in the cache the return values of the advised methods.
    2. org.wanghy.cache.interceptor.flush.CacheFlushInterceptor.

      Flushes the cache or parts of the cache before or after executing the advised methods.

  • Non-invasive framework. Applications using Wanghy-Cache do not have to extend particular classes or implement particular interfaces.

  • Caching services can be defined completely in the Spring configuration file. Optionally, caching services can be enabled using source-level metadata, providing a similar programming model to .NET ServicedComponents.

  • Wanghy-Cache automatically generates the key of the entries stored in the cache by combining the hash codes of the advised method and its arguments. Custom key generators can be created by implementing the interface org.wanghy.cache.keyCacheKeyGenerator.

  • Instead of imposing the use of a particular cache implementation, Wanghy-Cache lets you choose a cache provider that better suites the needs of your project. The supported cache providers are:

    1. EHCache
    2. JCS
    3. LRU Cache provided by Wanghy-Cache
    4. OSCache

  • Because Wanghy-Cache is based on interfaces, rather than classes, it is easy to extend in order to add support for other cache providers.

  • Comprehensively Test Coverage. See the Clover test report.

For more information, see the Getting Started Guide, Change Report, Road Map, and the JavaDocs.


Caching services can be used to improve application performance. A very common example is the caching of data retrieved from a database. Even though ORM frameworks such as iBATIS and Hibernate already provide built-in caching, Wanghy-Cache can be useful when:

  • Executing methods that perform heavy calculations, are time-consuming and/or are resource-hungry.
  • When using straight JDBC, Spring JDBC, or any ORM framework that does not support caching.
  • When you want to choose the cache implementation to use and/or you want to have more control on the cache.


Special thanks to my wife Yvonne for her love and support. To my friend and co-worker Ernesto Gonzalez, whose input made possible to implement some of the most important features of this project.