Uploaded image for project: 'Advanced Cache'
  1. Advanced Cache
  2. MGNLADVCACHE-97

NotifyFlushListeningPolicy flushes persistent cache on restart entirely

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • 1.8.2, 1.9
    • core
    • None

      Due to a missing slash, Magnolia does not determine the lastUpdateTimestamp of the cache correctly, which leads to an entire cache clear at module (re-)start.

      Here's the relevant code snippet:

      https://git.magnolia-cms.com/projects/ENTERPRISE/repos/advanced-cache/browse/magnolia-advanced-cache/src/main/java/info/magnolia/module/advancedcache/NotifyFlushListeningPolicy.java#138

                      if (!session.propertyExists(path + TIMESTAMP)) {
                          cache.clear();
                          timestamp = System.currentTimeMillis();
                      } else {
                          timestamp = session.getProperty(path + TIMESTAMP).getLong();
                      } 

      Path, which is something like /NotifyFlushListeningPolicy/defaultPageCache is concatenated with lastUpdateTimeStamp and this leads to property lookup like /NotifyFlushListeningPolicy/defaultPageCachelastUpdateTimeStamp which obviously isn't a correct path. There's a slash missing right before lastUpdateTimeStamp.

      The consequence of this is, that even a persistent cache is flushed entirely upon restart.

      Please patch the code with:

                      if (!session.propertyExists(path + "/" + TIMESTAMP)) {
                          cache.clear();
                          timestamp = System.currentTimeMillis();
                      } else {
                          timestamp = session.getProperty(path + "/" + TIMESTAMP).getLong();
                      } 

        Acceptance criteria

              Unassigned Unassigned
              vivi Vivian Steller
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:

                  Bug DoR
                  Task DoD