About Searching The Search API allows you to execute arbitrarily complex queries against caches. The development of alternative indexes on values provides the ability for data to be looked up based on multiple criteria instead of just keys. Note: Ter…
About Write-Through and Write-Behind Caches Write-through caching is a caching pattern where writes to the cache cause writes to an underlying resource. The cache acts as a facade to the underlying resource. With this pattern, it often makes sense to…
About Explicit Locking Ehcache contains an implementation which provides for explicit locking, using read and write locks. With explicit locking, it is possible to get more control over Ehcache 's locking behavior to allow business logic to apply an…
About Transaction Support Transactions are supported in versions of Ehcache 2.0 and higher. The 2.3.x or lower releases only support XA. However since ehcache 2.4 support for both Global Transactions with xa_strict and xa modes, and Local Transaction…
About Cache Loaders A CacheLoader is an interface that specifies load() and loadAll() methods with a variety of parameters. CacheLoaders are incorporated into the core Ehcache classes and can be configured in ehcache.xml. CacheLoaders are invoked in…
About Cache Decorators Ehcache uses the Ehcache interface, of which Cache is an implementation. It is possible and encouraged to create Ehcache decorators that are backed by a Cache instance, implement Ehcache and provide extra functionality. The Dec…
About the Key Classes Ehcache consists of a CacheManager, which manages logical data sets represented as Caches. A Cache object contains Elements, which are essentially name-value pairs. You can use Cache objects to hold any kind of data that you wan…
About Cache Eviction Algorithms A cache eviction algorithm is a way of deciding which element to evict when the cache is full. In Ehcache , the memory store and the off-heap store might be limited in size. When these stores get full, elements are evi…
Creating a CacheManager All usages of the Ehcache API start with the creation of a CacheManager. The following code snippets illustrate various ways to create one. Singleton versus Instance The following creates a singleton CacheManager using default…
There are several common access patterns when using a cache. Ehcache supports the following patterns: Cache-aside (or direct manipulation) Cache-as-sor (a combination of read-through and write-through or write-behind patterns) Read-through Write-thro…