1

After a little research on ehcache we found that 'net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache' is the best match for our requirement.

I have followed suggestions given in the forum post (https://sourceforge.net/forum/message.php?msg_id=7382649) and realized that I can only replace the decorator cache with the actual ehcache with the help of a helper method on the CacheManager programmatically.

The question I wanted to ask is that using ehcache.xml file I was able to describe all the Ehcaches i wanted to use in my system. I feel its intuitive to declare the ehcache decorators as well in the XML itself so that I can completely centralize all my configuration at one place itself. i.e. ehcache XML. Is there a way we can add configuration for a decorator in the ehcache.xml itself ?

kss
  • 169
  • 1
  • 11

2 Answers2

1

I found a good example of using cusom cache decorators

Specifying global EhCache capacity

 <cache name="singleSharedCache" maxElementsInMemory="2000"
   eternal="false" overflowToDisk="false">
<cacheDecoratorFactory class="com.xyz.util.CustomEhcacheDecoratorFactory"
    properties="name=org.hibernate.tutorial.domain.Person" />
<cacheDecoratorFactory class="com.xyz.util.CustomEhcacheDecoratorFactory"
    properties="name=org.hibernate.tutorial.domain.Event" />
</cache>
Community
  • 1
  • 1
Paul John
  • 1,626
  • 1
  • 13
  • 15
0

You should find all the information on this in the cache decorators documentation.

And it is indeed possible to declare decorated caches from XML.

Louis Jacomet
  • 13,661
  • 2
  • 34
  • 43