We are using Atlassian cache in our plugins for a while. Basically we are following the guidelines here: https://developer.atlassian.com/server/confluence/atlassian-cache-2-overview/
We try to make things “correct way” with read-through cache population by implementing “CacheLoader” interface. We only use com.atlassian.cache.CacheLoader#load and com.atlassian.cache.ManagedCache#clear methods. We avoid using com.atlassian.cache.Cache#put as said in document.
One thing we cannot figure out completely is that is it safe to use com.atlassian.cache.Cache#remove(K) method in our plugin code. We generally use cache to store some commonly used parameters of our plugin and we know exactly when those parameters get changed so we can simply invalidate the value belongs to that parameter. (It is critical that invalidate value of that parameter in cache for all nodes to prevent any misbehaviour). Currently we simply clear whole cache just to be sure.
What I would like to ask is that:
Is it safe to use com.atlassian.cache.Cache#remove(K) method in plugin code in terms of Atlassian’s cache 2 guidelines?
Does calling com.atlassian.cache.Cache#remove(K) guarantees that all other nodes in a DC environment will also drop cache value for given key?
Appreciate any answers and your experiences on this matter.