Announcement Announcement Module
Collapse
No announcement yet.
How to configure BlockingCache (Ehcache)? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to configure BlockingCache (Ehcache)?

    I tried to configure a Ehcache's BlockingCache by setting blocking=true in my EhCacheFactoryBean, but it doesn't seem to have any impact. Did I do something wrong? Below is my relevant config (I'm using Spring 3.1.0.RELEASE)

    Appreciate if someone can share a working configuration.

    Thanks,
    Khoa

    Code:
    <!-- Ehcache library setup -->
    	<cache:annotation-driven />
    	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
    		p:cache-manager-ref="ehcache" />
    
    	<bean id="ehcache"
    		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
    		p:config-location="classpath:ehcache.xml" />
    
    	<bean id="cacheFactory" abstract="true"
    		class="org.springframework.cache.ehcache.EhCacheFactoryBean">
    		<property name="blocking" value="true" />
    		<property name="cacheName" value="subs" />
    		<property name="cacheManager" ref="cacheManager" />
    	</bean>
    My ehcache.xml:

    Code:
    <cache eternal="false" maxElementsInMemory="10000" name="subs" 
    		timeToLiveSeconds="300"
    		overflowToDisk="true" diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000"
    		diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
    		memoryStoreEvictionPolicy="LRU" statistics="false">
    		<cacheWriter writeMode="write-through" 
    			notifyListenersOnException="true">
    		</cacheWriter>
    	</cache>
Working...
X