litespeedtech / lscache-drupal

LSCache Plugin for Drupal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tags based invalidation not working because LSCacheTagsInvalidator::$tags gets overwritten

lupupitkanen opened this issue · comments

Editing content does not purge LSCache tags automatically at the moment because wrong tags are sent in the X-LiteSpeed-Purge HTTP response header.

If we are editing node 48 in Drupal for example, the correct cache purge tag list would be something like4xx-response,node:48,node_list but for example tags 4xx-response,menu_link_content:33,menu_link_content_list are actually set in the header.

Because of this, only way to purge cache successfully is manual Clear this site or Clear all operation from the LSCache module settings.

Debug logging the LSCacheTagsInvalidator -> invalidateTags function reveals that correct tags are first populated to LSCacheTagsInvalidator::$tags but it gets overwritten with subsequents calls that produce route_match, menu_link_content and menu_link_content_list tags which are incorrect for purging the cache. The last iteration is what gets actually sent in the X-LiteSpeed-Purge header.