cachinginfinispancachemanager

Infinispan: How many DefaultCacheManager Instances?


In my web application project i have to build 2 kind on caching mechanism.

The first one is strictly related to the session. So i have implemented a job made pattern by which i can clean the infinispan cache when the user session is ended.

Distributed session cache makes use of 1 single DefaultCacheManager stored inside my application server JNDI. So every time it needs to write or read from the cache, it lookup for it ad makes the CRUD operations.

The second one is a normal infinispan distributed cache with its expiration policy and i'm going to implement it.

My question is:

is it correct to use the same DefaultCacheManager bound with JNDI? or is it better to create new one?

On infinispan guide i read it's a really heavy object and it's suggested to create just one.

Thanks.


Solution

  • Yes, I agree with @Jakub. The only reason why you might want to have separate CacheManagers is when you need them to operate on separate clusters, which is not your case.