@Override
public void invalidate(final String key) {
if (!isEnabled()) {
return;
}
if (dependencyCache == null) {
LOG.error("Cache configuration is invalid! NOT Caching. Check EH Cache configuration.");
return;
}
String dependencyKey = getKey(key);
Element dependencyElement = dependencyCache.get(dependencyKey);
if (dependencyElement != null) {
LOG.info("Expire key: {} from dependency cache", dependencyKey);
setExpired(dependencyElement, ADJUST_TTL);
ConcurrentSkipListSet<String> cacheSet = ((CacheElement<ConcurrentSkipListSet<String>>) dependencyElement
.getObjectValue()).getPayload();
if (cacheSet != null) {
for (String cacheKey : cacheSet) {
LOG.debug("Expire cache key: {} from cache", cacheKey);
Element cacheElement = cache.get(cacheKey);
setExpired(cacheElement, 0);
}
}
} else {
LOG.info("Attempting to expire key {} but not found in dependency cache", dependencyKey);
}
}