I am using Infinispan with WildFly AS 9, version 7.2.3.Final.
In order to get a cluster safe cache for data, stored in a tree structure, I chose the approach depicted below. The data is made up of entities in one table, which simply is read as a whole and stored into an Infinispan cache.
On server startup, read all entities and store them into a cluster wide Infinispan cache.
Based on this cache, set up memory based structures (maps etc.) for fast access (a tree and some application driven maps).
This works fine so far, but I am not sure about the best approach for updates to the cache. These updates must be reflected in the memory based structures.
I am aware of the @Listener-approach, but this allows me to react to single entry events, i.e. CacheEntryModified, CacheEntryCreated, CacheEntryDeleted. Actually, I would like to react to such events in a bulk fashion, meaning, that in the callback I would have access to a collection of modified (created, deleted) entries.