Wanghy-Cache provides a common interface
that contains and centralizes the interactions with the underlying cache
provider. Each facade must implement the interface
org.wanghy.cache.provider.CacheProviderFacade
or subclass the template
org.wanghy.cache.provider.AbstractCacheProviderFacadeImpl
.
All the provided facades have these common properties:
cacheManager
(required).
A cache manager administrates the cache.
In general, a cache manager should be able to:
The cache manager can be replaced by a factory that creates a
singleton instance of the cache manager. Such factory allows custom
configuration of the cache manager (depending on the cache provider)
and ensures that the Spring container shuts down the cache
manager when the factory is destroyed by the BeanFactory
.
Wanghy-Cache supplies factories
for the supported cache providers.
(with the exception of EHCache, which
is provided by the Spring Framework).
Each factory must subclass
org.wanghy.cache.provider.AbstractSingletonCacheManagerFactoryBean
or,
org.wanghy.cache.provider.AbstractConfigurationResourceCacheManagerFactoryBean
if the factory uses a configuration file to create the cache manager.
(with the exception of EHCache, which
is provided by the Spring Framework)
cacheProfiles
(required).
A cache profile tells the cache provider how to cache objects and how to flush the cache.
Cache profiles can be defined as a:
java.util.Map
java.util.Properties
"[propertyName1=propertyValue1][propertyName2=propertyValue2]"
where each of the properties of the cache profile is specified
between brackets. The fully qualified class name is not
necessary because the facade chooses the class of the cache profile
that is suitable for the chosen cache provider.
failQuietlyEnabled
(optional).
Indicates if an exception should thrown or not when an error occurrs when accessing the cache.
Default value is false
.
The following sections contain more details about setting up each supported cache provider.