Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-4558

Make caching of errors (and different types of errors) configurable

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Neutral Neutral
    • None
    • 4.5.4
    • cache
    • None

      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).

        Acceptance criteria

              Unassigned Unassigned
              had Jan Haderka
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD