2
如果我们想要定制驱逐政策除了LRU LFU FIFO,文件建议报告的方式是实现接口政策再设置MemoryStoreEvictionPolicy像:对自定义的Ehcache驱逐政策,春天
manager = new CacheManager(EHCACHE_CONFIG_LOCATION);
cache = manager.getCache(CACHE_NAME);
cache.setMemoryStoreEvictionPolicy(new MyPolicy());
,但如果我用弹簧,使用@可缓存和xml文件,如
<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml" ></property>
</bean>
<!-- cacheManager -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="cacheManagerFactory" />
</bean>
我怎样才能在春季注入我自己的策略?
谢谢大家
感谢这真的合理 – cedrics