Metatag Views integrations contains Views cache plugin wrapper to defer cache set for view results.

As it is implementing is's own logic how to set/get cache and it overrides cache logic defined by original cache plugin.

One example is Search API cache plugin.
It has CacheSet to store original results retrieved from cache backend server and CacheGet to trick that search was performed and need data is set https://git.drupalcode.org/project/search_api/-/blob/8.x-1.x/src/Plugin/...

Metatag's cache wrapper decorates that plugin and overrides entire cache set/get https://git.drupalcode.org/project/metatag/-/blob/8.x-1.x/metatag_views/... with it's own login and the original login is no longer used and destroys plugins logic.

This causes issue that #3258080: Facets disappear on refresh because cached view does not populate data correctly after cache get (as correct cache was not set at all)

Issue fork metatag-3261473

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Evaldas Užkuras created an issue. See original summary.

eugene bocharov’s picture

I agree, MetatagViewsCacheWrapper is added as decorator, but it doesn't pass through the cacheSet/cacheGet calls to the decorated cache plugin for views result. This can and boviously do cause the problems with caching.

Maybe we should use some another approach to store the first row tokens cache, saving it in separate cache, for example.

Just for reference, MetatagViewsCacheWrapper was intoduced in https://www.drupal.org/project/metatag/issues/2952229

saidatom made their first commit to this issue’s fork.

socialnicheguru’s picture

Status: Active » Needs review
eliosh’s picture

Any news on this issue?

damienmckenna’s picture

Status: Needs review » Needs work

The merge request needs further work.

b_sharpe’s picture

MR needs a rebase, I took a look but unsure as to exactly what it's doing... it removes the decorator but then edits the wrapper so I'm unsure if I'm missing something here?

claudiu.cristea made their first commit to this issue’s fork.

claudiu.cristea’s picture

Status: Needs work » Reviewed & tested by the community

Rebased and works as expected

damienmckenna’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new5.96 KB

How would we test this?

Here's the latest merge request in patch format.

hitchshock’s picture

+1 RTBC. The patch fixed the issue for me.
But I agree with @damienmckenna, it's an interesting question about how to test it.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

This fixed the issue with memory. Had a large site with redis, views and metatag_views and this caused us quite an issue for a while. Applying the patch fixes that.

damienmckenna’s picture

Parent issue: » #3296327: Plan for Metatag 8.x-1.22
StatusFileSize
new5.25 KB

Rerolled.

damienmckenna’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.26 KB
new6.14 KB

Missed a bit.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Looks good by me.

  • DamienMcKenna committed d934f7e on 8.x-1.x
    Issue #3261473 by DamienMcKenna, saidatom, claudiu.cristea, heddn,...
damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed

Thanks heddn! Committed. Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.