[MGNLADVCACHE-116] Site aware caching no longer creates site caches Created: 11/Aug/20  Updated: 30/Jul/21  Resolved: 22/Jul/21

Status: Closed
Project: Advanced Cache
Component/s: None
Affects Version/s: 2.3.3
Fix Version/s: 2.3.4

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Federico Grilli
Resolution: Fixed Votes: 2
Labels: cache, maintenance, site-aware
Remaining Estimate: Not Specified
Time Spent: 1h 22m
Original Estimate: Not Specified

Attachments: Text File cache-uninitialized-1.txt     Text File cache-uninitialized.txt     File config.modules.cache.config.contentCaching.defaultPageCache.yaml     File config.server.filters.cache.yaml     Text File patch.patch     Text File site-aware-cache-problem.log    
Issue Links:
Problem/Incident
is caused by MULTISITE-92 Multisite module: implement limitation Closed
causality
dependency
is depended upon by MGNLADVCACHE-112 DOC: Clarify that site aware caching ... Closed
relation
is related to MGNLADVCACHE-115 Unable to create site aware caches at... Closed
is related to MULTISITE-92 Multisite module: implement limitation Closed
is related to MGNLADVCACHE-110 Improve advanced cache debug/trace lo... Closed
is related to MGNLCACHE-231 Improve cache debug/trace logging Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Date of First Response:
Sprint: Maintenance 67
Story Points: 3

 Description   

By adding some additional logging (MGNLCACHE-231 & MGNLADVCACHE-110) we can see that site aware caching does not seem to be functioning correctly.

Set your log4j2.xml when using the snapshots from the attached tickets:

    <Logger name="info.magnolia.module.cache" level="ALL"/>
    <Logger name="info.magnolia.module.advancedcache" level="ALL"/>

Recreate:

  • Set your instance for site aware caching.
  • Fill a couple caches with requests from the travel site and sportstation site.
  • Verify the cache filter is serving them from cache and the name of the cache it serves from.
  • Publishing sportstation.
  • Observe requests still coming from sportstation cache which we can now see is not being flushed after publication.
    2020-08-11 18:41:38,094 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel.html', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@54cf2a64[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597163944277,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]}
    2020-08-11 18:41:38,094 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@54cf2a64[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597163944277,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]
    2020-08-11 18:41:38,100 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=store, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/0', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=null}
    2020-08-11 18:41:38,121 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
    2020-08-11 18:41:38,122 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired -1
    2020-08-11 18:41:38,122 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: lowestVote vote is now -1
    2020-08-11 18:41:38,129 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@30b9fa97[gzippedContent=914 bytes,plainContent=4033 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList={Last-Modified=[1597164098100]},lastModificationTime=1597164098100,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/0,timeToLiveInSeconds=-1]
    2020-08-11 18:41:38,131 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=store, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/00', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=null}
    2020-08-11 18:41:38,191 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
    2020-08-11 18:41:38,191 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired -1
    2020-08-11 18:41:38,191 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: lowestVote vote is now -1
    2020-08-11 18:41:38,194 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@2a8e275f[gzippedContent=660 bytes,plainContent=2432 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList={Last-Modified=[1597164098132]},lastModificationTime=1597164098132,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/00,timeToLiveInSeconds=-1]
    
    
    2020-08-11 18:41:52,700 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=sportstation, cacheKey=DefaultCacheKey{uri='/sportstation.html', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@7bc42522[gzippedContent=3921 bytes,plainContent=32293 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164079373,originalUrl=http://localhost:8080/dx-core-webapp/sportstation.html,timeToLiveInSeconds=-1]}
    2020-08-11 18:41:52,701 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@7bc42522[gzippedContent=3921 bytes,plainContent=32293 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164079373,originalUrl=http://localhost:8080/dx-core-webapp/sportstation.html,timeToLiveInSeconds=-1]
    
    
    2020-08-11 18:42:54,621 INFO  r.operation.jcr.JcrTransactionPublicationOperation: 377:1597164171492 User superuser successfully published website:/sportstation on dx-core-webapp.
    2020-08-11 18:42:59,775 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: site
    2020-08-11 18:42:59,776 TRACE info.magnolia.module.cache.FlushAllListeningPolicy: Cache flushed: uuid-key-mapping
    2020-08-11 18:42:59,778 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: defaultPageCache
    
    
    2020-08-11 18:43:30,407 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel.html', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@54cf2a64[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597163944277,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]}
    2020-08-11 18:43:30,407 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@54cf2a64[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597163944277,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]
    2020-08-11 18:43:30,410 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/0', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@4cddec84[gzippedContent=914 bytes,plainContent=4033 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164098100,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/0,timeToLiveInSeconds=-1]}
    2020-08-11 18:43:30,411 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@4cddec84[gzippedContent=914 bytes,plainContent=4033 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164098100,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/0,timeToLiveInSeconds=-1]
    2020-08-11 18:43:30,413 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/00', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@5ea1a6d6[gzippedContent=660 bytes,plainContent=2432 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164098132,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/00,timeToLiveInSeconds=-1]}
    2020-08-11 18:43:30,414 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@5ea1a6d6[gzippedContent=660 bytes,plainContent=2432 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164098132,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/00,timeToLiveInSeconds=-1]
    2020-08-11 18:43:30,509 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=store, cacheName=defaultPageCache, cacheKey=DefaultCacheKey{uri='/.imaging/mte/travel-demo-theme/1366/dam/tours/ruben-mishchuk-571314-unsplash/jcr:content/ruben-mishchuk-571314-unsplash.jpg', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=null}
    2020-08-11 18:43:30,509 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=store, cacheName=defaultPageCache, cacheKey=DefaultCacheKey{uri='/.imaging/mte/travel-demo-theme/1366/dam/tours/ash-edmonds-441220-unsplash/jcr:content/ash-edmonds-441220-unsplash.jpg', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=null}
    2020-08-11 18:43:30,509 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=store, cacheName=defaultPageCache, cacheKey=DefaultCacheKey{uri='/.imaging/mte/travel-demo-theme/1366/dam/tours/simon-mumenthaler-199501-unsplash/jcr:content/simon-mumenthaler-199501-unsplash.jpg', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=null}
    2020-08-11 18:43:30,512 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
    2020-08-11 18:43:30,512 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
    2020-08-11 18:43:30,512 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired 2147483647
    2020-08-11 18:43:30,512 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired 2147483647
    2020-08-11 18:43:30,512 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
    2020-08-11 18:43:30,512 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired 2147483647
    2020-08-11 18:43:30,520 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@49a7691c[gzippedContent=115968 bytes,plainContent=121048 bytes,contentType=image/jpeg,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList={Last-Modified=[1597164210509], Content-Type=[image/jpeg]},lastModificationTime=1597164210509,originalUrl=http://localhost:8080/dx-core-webapp/.imaging/mte/travel-demo-theme/1366/dam/tours/simon-mumenthaler-199501-unsplash/jcr:content/simon-mumenthaler-199501-unsplash.jpg,timeToLiveInSeconds=-1]
    2020-08-11 18:43:30,521 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@4dbda4b5[gzippedContent=170959 bytes,plainContent=171169 bytes,contentType=image/jpeg,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList={Last-Modified=[1597164210509], Content-Type=[image/jpeg]},lastModificationTime=1597164210509,originalUrl=http://localhost:8080/dx-core-webapp/.imaging/mte/travel-demo-theme/1366/dam/tours/ash-edmonds-441220-unsplash/jcr:content/ash-edmonds-441220-unsplash.jpg,timeToLiveInSeconds=-1]
    2020-08-11 18:43:30,533 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@62ce6a95[gzippedContent=350291 bytes,plainContent=350324 bytes,contentType=image/jpeg,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList={Last-Modified=[1597164210509], Content-Type=[image/jpeg]},lastModificationTime=1597164210509,originalUrl=http://localhost:8080/dx-core-webapp/.imaging/mte/travel-demo-theme/1366/dam/tours/ruben-mishchuk-571314-unsplash/jcr:content/ruben-mishchuk-571314-unsplash.jpg,timeToLiveInSeconds=-1]
    
    
    2020-08-11 18:43:52,271 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=sportstation, cacheKey=DefaultCacheKey{uri='/sportstation.html', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@7bc42522[gzippedContent=3921 bytes,plainContent=32293 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164079373,originalUrl=http://localhost:8080/dx-core-webapp/sportstation.html,timeToLiveInSeconds=-1]}
    2020-08-11 18:43:52,271 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@7bc42522[gzippedContent=3921 bytes,plainContent=32293 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597164079373,originalUrl=http://localhost:8080/dx-core-webapp/sportstation.html,timeToLiveInSeconds=-1]
    

Expected:
The sportstation cache should be flushed.

Workaround:
Touch the cache config so the cache is restarted with all sites available.

Notes
If you look at the entire log site-aware-cache-problem.log you can see I have three sites. One other site called /home. This page seems to be cache with the defaultPageCache.

2020-08-11 18:39:47,213 DEBUG info.magnolia.module.cache.filter.CacheFilter  : 
Cache policy result: CachePolicyResult{behaviour=store, cacheName=defaultPageCache, 
cacheKey=DefaultCacheKey{uri='/home.html', serverName='localhost', locale='en', 

The home site does not have a site definition. However, shouldn't the cache be called "home" as well. It would be great if we could clarify in the instructions how it works.

When using the workaround of touching the cache config the log reports the caches as being uninitialized. See cache-uninitialized.txt

Solution
As hinted below in Viet's comment, site caches were not created correctly upon starting up Magnolia, since multisite module waits until all modules have started in order to register sites. In the same way, advanced cache initialises site aware caches upon ModulesStartedEvent after multisite is done registering sites.



 Comments   
Comment by Roman Kovařík [ 12/Aug/20 ]

This might got broken with MULTISITE-92.

The startup sequence should be:

  1. Start site module (one site called "site")
  2. Start multisite module and register sites (override the only "site")
  3. Start advanced cache, create caches per site.

But now the site registration seems to be postphoned:

  1. Start site module (one site called "site")
  2. Start multisite module
  3. Start advanced cache, create caches per site (but there is still just one "site").
  4. Post registration of sites (override the only "site") but at this point cache is already misconfigured.

Workaround:
Touch the cache config so the cache is restarted with all sites available.
 

Comment by Richard Gange [ 12/Aug/20 ]

Yes, you are right. Refreshing did help. Now the travel and sportstation site are behaving correctly.

One problem still exists. I have another site called home. When I refreshed the cache I did get a home cache created. It should be known I added a configuration that looks like this now:

'contentCaching':
  'defaultPageCache':
   ...
   ...
   ...
  'travel':
    'extends': '../defaultPageCache'
  'sportstation':
    'extends': '../defaultPageCache'
  'home':
    'extends': '../defaultPageCache'

So I am explicitly configuring the caches by name.

However, a request for home still goes into defaultPageCache:

2020-08-12 15:30:54,731 INFO  r.operation.jcr.JcrTransactionPublicationOperation: 376:1597239050436 User superuser successfully published website:/sportstation on dx-core-webapp.
2020-08-12 15:30:59,885 WARN  nfo.magnolia.module.cache.ehcache3.EhCache3Wrapper: Cache named {site} is UNINITIALIZED. Ignoring any calls on it. This might happen when editing the Ehcache factory configuration at runtime
2020-08-12 15:30:59,885 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: site
2020-08-12 15:30:59,888 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: home
2020-08-12 15:30:59,890 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: sportstation
2020-08-12 15:30:59,891 TRACE info.magnolia.module.cache.FlushAllListeningPolicy: Cache flushed: uuid-key-mapping
2020-08-12 15:30:59,898 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: defaultPageCache


2020-08-12 15:31:28,758 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel.html', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@5247b616[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238798255,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]}
2020-08-12 15:31:28,758 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@5247b616[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238798255,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]
2020-08-12 15:31:28,762 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/0', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@76071c8d[gzippedContent=914 bytes,plainContent=4033 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980183,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/0,timeToLiveInSeconds=-1]}
2020-08-12 15:31:28,763 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@76071c8d[gzippedContent=914 bytes,plainContent=4033 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980183,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/0,timeToLiveInSeconds=-1]
2020-08-12 15:31:28,764 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/00', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@890c07c[gzippedContent=660 bytes,plainContent=2432 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980209,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/00,timeToLiveInSeconds=-1]}
2020-08-12 15:31:28,764 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@890c07c[gzippedContent=660 bytes,plainContent=2432 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980209,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/00,timeToLiveInSeconds=-1]


2020-08-12 15:31:39,321 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=store, cacheName=defaultPageCache, cacheKey=DefaultCacheKey{uri='/home', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=null}
2020-08-12 15:31:39,342 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
2020-08-12 15:31:39,342 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired 2147483647
2020-08-12 15:31:39,344 DEBUG info.magnolia.module.cache.executor.UseCache      : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@151976c4[gzippedContent=534 bytes,plainContent=1153 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList={Last-Modified=[1597239099321], Content-Type=[text/html]},lastModificationTime=1597239099321,originalUrl=http://localhost:8080/dx-core-webapp/home,timeToLiveInSeconds=-1]


2020-08-12 15:31:57,452 DEBUG info.magnolia.module.cache.filter.CacheFilter     : Cache policy result: CachePolicyResult{behaviour=store, cacheName=sportstation, cacheKey=DefaultCacheKey{uri='/sportstation', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=null}
2020-08-12 15:31:57,812 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
2020-08-12 15:31:57,812 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired 2147483647

It seems to me this is also tied to site definition as well, correct? I want to clarify that in the docs if true.

Comment by Roman Kovařík [ 12/Aug/20 ]

You don't need to do

'contentCaching':
  'defaultPageCache':
  'travel':
    'extends': '../defaultPageCache'

Caches are created on the fly from the defaultPageCache if a specific config is not provided.

It seems to me this is also tied to site definition as well, correct? I want to clarify that in the docs if true.

Yes it uses the path mapping from the site definition.

You don't need to explicitly configure anything per site, just change the filter class and flush policy class.

Comment by Roman Kovařík [ 20/Aug/20 ]

Something like patch.patch . This will probably register sites twice at startup though.

Comment by Viet Nguyen [ 08/Jun/21 ]

This work around from the code maybe the cause of the issue:
https://git.magnolia-cms.com/projects/ENTERPRISE/repos/advanced-cache/browse/magnolia-advanced-cache/src/main/java/info/magnolia/module/advancedcache/AbstractSiteAwareListeningFlushPolicy.java#90

This is an workaround to retrieve the site before the Multisite module is started. {@link SiteManager#getSite(String)} performs license check which cannot be done before the Multisite is started (in case the Multisite is installed) but {@link SiteManager#getSites()} doesn't.

Fixing could be implement a ModulesStartedEvent.Handler so that cache module could be initialized after all modules started. Please mind the infinite loop in case you start the cache module again

Generated at Sun Feb 11 23:11:10 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.