RWS / dxa-web-application-java

SDL Digital Experience Accelerator Java Spring MVC web application
25 stars 37 forks source link

Incorrect/old content being shown due to lack of page context in EntitiesCache #116

Closed willprice76 closed 5 years ago

willprice76 commented 5 years ago

If I have a component C which is used (as a static component presentation) on more than one page, but I have not republished one of the pages since updating the component, then it is possible that the old version of the component will be shown on ALL pages containing that component.

Page P contains component C and has URL /subsite1/p Page R contains component C and has URL /subsite2/r

C has been updated, but only page R has been republished

If (starting with empty cache) and access P, then the old version of C will be shown (as expected), but also an entry will be created in the EntitiesCache with that old content. If I now access page R, it will read the entry for C out of the EntitiesCache and show the old content, despite R having been republished.

Furthermore, with the addition of context aware linking (see Issue #104) we also have a problem that if the component contains component links to components which are used in more than one page, that the link will be incorrect for all pages except the one which triggers the component entry into the cache:

Component C links to Component D Page Q contains component D and has URL /subsite1/q The component link from C should thus resolve to /subsite1/q

Page S contains component D and has URL /subsite2/s The component link from C should thus resolve to /subsite1/s

However, with caching on, if I access first page P, an entry will be created in the EntitiesCache for component C with link URL /subsite1/q. If I then access page R, it will read the entity for C out from the cache with link URL /subsite/s which is incorrect.

The solution to both these problems is to add the page ID (if there is one) to the cache key for the EntitiesCache

rpannekoek commented 5 years ago

Internal Issue ID (for tracking purposes): CRQ-12804

rpannekoek commented 5 years ago

Fixed in DXA 2.2