The facade for LRU Cache
should be an instance of
org.wanghy.cache.provider.lru.LruCacheFacade
.
Properties:
cacheManager (required).
Should be an implementation of the interface
org.wanghy.cache.provider.lru.LruCacheManager
.
The default implementation is
org.wanghy.cache.provider.lru.LruMapCacheManager
.
We can also use the factory
org.wanghy.cache.provider.lru.LruCacheManagerFactoryBean
Properties:
maxSize
(optional).
The maximum capacity of the cache manager. Should be greater than one.
The default maximum capacity is
LruMapCacheManager.DEFAULT_MAX_SIZE
.
scanUntilRemovable
(optional).
Indicates if the cache manager should scan until a removeable entry is found.
The default value is false
.
cacheProfiles
(required).
Each cache profile should be an instance of
org.wanghy.cache.provider.lru.LruCacheProfile
Properties:
group
(required).
The group a cache entry belongs to.
refreshPeriod
(optional).
How long an entry can stay in cache (in seconds).
For general information about setting up the cache provider please read "Setting up the Cache Provider".
The cache profiles are defined as a java.util.Map
:
<bean id="cacheManager" class="org.wanghy.cache.provider.lru.LruCacheManagerFactoryBean"> </bean> <bean id="cacheProvider" class="org.wanghy.cache.provider.lru.LruCacheFacade"> <property name="cacheManager"> <ref local="cacheManager" /> </property> <!-- Cache profiles specified as a java.util.Map --> <property name="cacheProfiles"> <map> <entry key="test"> <bean class="org.wanghy.cache.provider.lru.LruCacheProfile"> <property name="group"> <value>testGroup</value> </property> </bean> </entry> </map> </property> </bean>
The cache profiles are defined as a java.util.Properties
:
<bean id="cacheManager" class="org.wanghy.cache.provider.lru.LruCacheManagerFactoryBean"> </bean> <bean id="cacheProvider" class="org.wanghy.cache.provider.lru.LruCacheFacade"> <property name="cacheManager"> <ref local="cacheManager" /> </property> <!-- Cache profiles specified as a java.util.Properties --> <property name="cacheProfiles"> <props> <prop key="test">[group=testGroup]</prop> </props> </property> </bean>