// construct the current cache key
this.cacheKey = this.constructCacheKey();
// check for a cached value first
CacheValue cachedValue = this.getCachedValue(this.cacheKey);
if (cachedValue != null) {
// cached value found -> write it
if (this.logger.isDebugEnabled()) {
this.logger.debug("Write cache value to output stream: " + cachedValue);
}
cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
if (!cachedValue.isValid(this.cacheKey)) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Cached value is not up to date. Delegating to " + this.cacheRefreshManager);
}
// the cached value is not valid -> refresh the value
this.cacheRefreshManager.refreshCacheValue(this.cacheKey, this);