package info.magnolia.module.cache.executor; import info.magnolia.module.cache.filter.CacheResponseWrapper; import info.magnolia.module.cache.filter.CachedEntry; import info.magnolia.module.cache.filter.CachedError; import java.io.IOException; import javax.servlet.http.HttpServletRequest; public class DoNotStoreErrorsStore extends Store { @Override protected CachedEntry makeCachedEntry(HttpServletRequest request, CacheResponseWrapper cachedResponse) throws IOException { CachedEntry entry = super.makeCachedEntry(request, cachedResponse); if (entry instanceof CachedError) { CachedError error = ((CachedError) entry); // override the entry with time to live set to 0 entry = new CachedError(error.getStatusCode(), error.getOriginalURL(), 0); } return entry; } }