Search code examples
infinispaninfinispan-10

Per Infinispan Cache Properties


We have some generic code that operates on the caches in an Infinispan cache container. The code identifies certain caches for which a certain operation has to be performed by a custom property. The cache container and caches are configured through infinspan.xml or the Infinispan subsystem in WildFly.

Previously we would set a custom property on the datastore of the cache. With Infinispan 10+ this is no longer possible. We would have to implement a custom persistence store in order to set arbitrary properties on a cache. This seems like overkill especially since our caches are not persistent.

Is there a way to achieve this from an infinspan.xml, eg. without putting a custom object under a well known key in the cache?

Edit

The previous configuration looked something like this:

<local-cache name="stackoverflow-cache" configuration="default-configuration">
  <data-container>
    <property name="custom-property-key">custom-property-value</property>
  </data-container>
</local-cache>

With version 10 of the Infinispan schema this is no longer supported.


Solution

  • I've made an example of how you can set some custom properties in the configuration here. It isn't trivial...

    If you are using Infinispan server, you need a Jar with your classes and put it in server/lib folder.

    Let me know if it fits your use case (I hope I didn't misunderstand it).

    ps. since you control the parser, you can set your own XML structure if you want.