[MAGNOLIA-4558] Make caching of errors (and different types of errors) configurable Created: 01/Oct/12  Updated: 26/Nov/13  Resolved: 26/Nov/13

Status: Closed
Project: Magnolia
Component/s: cache
Affects Version/s: 4.5.4
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Jan Haderka Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
duplicates MGNLCACHE-50 Provide possibility to exclude errors... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

this can already be achieved by using custom Store executor, like e.g.

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;
    }
}

but it should be in by default and configurable (disable caching for different kind of errors, cache different errors (based on status code) for different time intervals).


Generated at Mon Feb 12 03:56:56 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.