0

I am planning to use infinispan as my Hibernate app L2 cache. My all entities has a life cycle attribute [ New -> Run -> Completed ]. Initially my entities are in New state and when time goes it's moves to other states.

In simply I want to evict the entities from the cache when entity life cycle attribute status arrive to the Completed state. As par as my understanding Infinispan does not support custom eviction policies. what will be the best way to handle my situation ?

artless noise
  • 21,212
  • 6
  • 68
  • 105
era
  • 391
  • 4
  • 24

1 Answers1

1

I would implement my own logic with usage of evict(key) method from Cache API in the right time.

public void evict(K key)

Evicts an entry from the memory of the cache. Note that the entry is not removed from any configured cache stores or any other caches in the cluster (if used in a clustered mode). Use Cache.remove(Object) to remove an entry from the entire cache system.

Once entity with "key1" reaches its Completed state you can fire ispnCache.evict("key1"); for eviction.

tsykora
  • 723
  • 1
  • 8
  • 19