Element cachedElement = this.cache.get(id);
if (cachedElement == null)
{
// Not in the cache.
throw new ObjectExpiredException();
}
CachedObject obj = (CachedObject)cachedElement.getObjectValue();
if (obj.isStale())
{
if (obj instanceof RefreshableCachedObject)
{
RefreshableCachedObject rco = (RefreshableCachedObject) obj;
if (rco.isUntouched())
{
// Do not refresh an object that has exceeded TimeToLive
removeObject(id);
throw new ObjectExpiredException();
}
// Refresh Object
rco.refresh();
if (rco.isStale())
{
// Object is Expired, remove it from cache.
removeObject(id);
throw new ObjectExpiredException();
}
}
else
{
// Expired.
removeObject(id);
throw new ObjectExpiredException();
}
}
if (obj instanceof RefreshableCachedObject)
{