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

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

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Neutral
    • Resolution: Duplicate
    • Affects Version/s: 4.5.4
    • Fix Version/s: None
    • Component/s: cache
    • Labels:
      None

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: