Having a cache (clustering mode="local") persisting to a file using org.infinispan.loaders.file.FileCacheStore I do the following steps in it:
1.- cache.put(key, value)
2.- value = cache.get(key)
After these actions, I can see that the object kept in the cache in memory has the value set in step 3 but this change is not persisted in the file. When I stop my application and start it, the cache only has the object values which where in the object at the "put" time.
I found in the documentation the following: "Cache loader is Infinispan's connection to a (persistent) data store. Cache loader fetches data from a store when that data is not in the cache, and when modifications are made to data in the cache the CacheLoader is called to store those modifications back to the store."
Despite it, is this the normal behavior or am I doing something wrong?
Version: Infinispan 'Delirium' 5.2.1.Final
Infinispan does not intercept changes to mutable objects. In your case you would have the same problem not just with any CacheStore but also the value change would not be propagated to other nodes in the cluster.
I would advise to only store immutable objects to avoid such confusing situations.