Infinispan cache is not getting evicted in Azure Kubernates cluster nodes with EmbeddedCacheManager

31 Views Asked by At

I'm new to configuring Infinispan cache in Spring Boot. I've set up two Spring Boot applications, node 1 and node 2. I'm using Infinispan cluster cache and have created a bean using EmbeddedCacheManager with global configurations. In my setup, I populate the cache in node 2 and attempt to evict it in node 1, which works fine locally. However, when I deploy my apps to an Azure Kubernetes environment with two pods, app1 and app2, I encounter an issue where I can't evict the cache from app1 that was populated in app2.

ConfigurationBuilder confBuilder = new ConfigurationBuilder();
    confBuilder.expiration().lifespan(8, TimeUnit.HOURS);
    confBuilder.clustering().cacheMode(CacheMode.DIST_SYNC);
    confBuilder.clustering().stateTransfer().awaitInitialTransfer(false);
    confBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
    confBuilder.build()

    

I have tried locally where I can evict cache in one node from other node. Please help me with any suggestion or configuration changes. I'm wondering if I should switch to using RemoteCacheManager, or if there might be something wrong with my cache configuration.

1

There are 1 best solutions below

0
pruivo On

I assume you are invoking the Cache.evict() method. The Eviction is local to a cache and node. From evict() javadoc:

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).