use of com.adobe.acs.commons.httpcache.config.impl.HttpCacheConfigComparator in project acs-aem-commons by Adobe-Consulting-Services.
the class HttpCacheEngineImpl method bindHttpCacheConfig.
// -------------------<OSGi specific methods>---------------//
/**
* Binds cache config. Cache config could come and go at run time.
*
* @param cacheConfig
* @param configs
*/
protected void bindHttpCacheConfig(final HttpCacheConfig cacheConfig, final Map<String, Object> configs) {
// Validate cache config object
if (!cacheConfig.isValid()) {
log.info("Http cache config rejected as the request uri is absent.");
return;
}
// Check if the same object is already there in the map.
if (cacheConfigs.contains(cacheConfig)) {
log.trace("Http cache config object already exists in the cacheConfigs map and hence ignored.");
return;
}
// Sort cacheConfigs by order
final CopyOnWriteArrayList<HttpCacheConfig> tmp = new CopyOnWriteArrayList<HttpCacheConfig>(this.cacheConfigs);
tmp.add(cacheConfig);
Collections.sort(tmp, new HttpCacheConfigComparator());
this.cacheConfigs = tmp;
this.cacheConfigConfigs.put(cacheConfig, configs);
log.debug("Total number of cache configs added: {}", cacheConfigs.size());
}
Aggregations