in commons-jcs3-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCache.java [319:400]
protected void updateAuxiliaries(final ICacheElement<K, V> cacheElement, final boolean localOnly)
throws IOException
{
// UPDATE AUXILLIARY CACHES
// There are 3 types of auxiliary caches: remote, lateral, and disk
// more can be added if future auxiliary caches don't fit the model
// You could run a database cache as either a remote or a local disk.
// The types would describe the purpose.
if (!auxCaches.isEmpty())
{
log.debug("Updating auxiliary caches");
}
else
{
log.debug("No auxiliary cache to update");
}
for (final ICache<K, V> aux : auxCaches)
{
if (aux == null)
{
continue;
}
log.debug("Auxiliary cache type: {0}", aux.getCacheType());
switch (aux.getCacheType())
{
// SEND TO REMOTE STORE
case REMOTE_CACHE:
log.debug("ce.getElementAttributes().getIsRemote() = {0}",
cacheElement.getElementAttributes()::getIsRemote);
if (cacheElement.getElementAttributes().getIsRemote() && !localOnly)
{
try
{
// need to make sure the group cache understands that
// the key is a group attribute on update
aux.update(cacheElement);
log.debug("Updated remote store for {0} {1}",
cacheElement.getKey(), cacheElement);
}
catch (final IOException ex)
{
log.error("Failure in updateExclude", ex);
}
}
break;
// SEND LATERALLY
case LATERAL_CACHE:
// lateral can't do the checking since it is dependent on the
// cache region restrictions
log.debug("lateralcache in aux list: cattr {0}", cacheAttr::isUseLateral);
if (cacheAttr.isUseLateral() && cacheElement.getElementAttributes().getIsLateral() && !localOnly)
{
// DISTRIBUTE LATERALLY
// Currently always multicast even if the value is
// unchanged, to cause the cache item to move to the front.
aux.update(cacheElement);
log.debug("updated lateral cache for {0}", cacheElement::getKey);
}
break;
// update disk if the usage pattern permits
case DISK_CACHE:
log.debug("diskcache in aux list: cattr {0}", cacheAttr::isUseDisk);
if (cacheAttr.isUseDisk()
&& cacheAttr.getDiskUsagePattern() == DiskUsagePattern.UPDATE
&& cacheElement.getElementAttributes().getIsSpool())
{
aux.update(cacheElement);
log.debug("updated disk cache for {0}", cacheElement::getKey);
}
break;
default: // CACHE_HUB
break;
}
}
}