Search code examples
oracle-coherence

Oracle Coherence fast empty complete cluster


I'm having problems with a cache cluster to empty all cache data stores.

This cluster has 89 cache stores and lasts more than 40 minutes to completely unload data.

I'm using this function:

public void deleteAll() {
    try {
        getCache().clear();
    } catch (Exception e) {
        log.error("Error unloading cache",getCache().getCacheName());
    }
}

getCache Method retrieves a NamedCache of CacheFactory.

public NamedCache getCache() {
    if (cache == null) {
        cache = com.tangosol.net.CacheFactory.getCache(this.idCacheFisica);
    }

    return cache;
}

Has anyone found any other way to do this faster?

Thank you in advance,


Solution

  • It's strange it would take so long, though to be honest, it's unusual to call clear.

    You could try destroying the cache with NamedCache.destroy or CacheFactory.destroy(NamedCache).

    The only problem with this is that it invalidates any references that there might be to the cache, which would need to be re-obtained with another call the CacheFactory.getCache.