If you use Redis as a cache backend an error is thrown when saving the configuration form because the cache_data table doesn't exist.

Comments

hitfactory created an issue. See original summary.

hitfactory’s picture

As far as I understand there is no way to delete items from the cache matching a wildcard pattern like js:% in the original bit of code.

Here's a first pass at a patch which instead calls invalidateTags on items with the tag 'library_info'.

This prevents the error but will also invalidate cache items like css:%.

svenryen’s picture

Status: Active » Needs review

This sounds like a very good idea, thanks for the patch. Could you get somebody to RTBC this issue? I have no capacity to look at this until late June, due to GDPR issues and vacation.

hitfactory’s picture

Of course, it always helps to have Redis enabled on the server you're testing the patch on. :)

This patch actually prevents the original error instead of creating a new one!

I'm not entirely sure this the right approach but it at least prevents the error while May 25 looms ever closer.

So happy to leave it here until others weigh in.

Status: Needs review » Needs work
it-cru’s picture

Same problem with memcache as CacheBackend. Applied patch from #2 and now form is saved without an error.

@hitfactory: Which new error do you mean between patch #2 and #4 ?

hitfactory’s picture

With the patch in #2, I started getting the following error

Error: Call to undefined method Drupal\redis\Cache\Predis::invalidateTags() in /app/web/modules/contrib/eu_cookie_compliance/src/Form/EuCookieComplianceConfigForm.php on line 761

The invalidateTags method invalidates tags across all bins, hence the switch to Cache::invalidateTags() which Redis doesn't choke on.

Attached is a re-roll for latest dev which you can test with Memcache.

it-cru’s picture

Status: Needs work » Needs review

Patch from #7 also works for memcache backend. First I was confused using directly Cache::invaidateTags, but this is also provided in other docs. Set status of issue to 'Needs review'.

svenryen’s picture

Status: Needs review » Reviewed & tested by the community

I tested the patch both with and without Redis installed, and this seems to be a better way of invalidating cache than what was suggested in #2978326: Query on EuCookieComplianceConfigForm to cache table. Applying this one to -dev

  • svenryen committed a9f7476 on 8.x-1.x authored by hitfactory
    Issue #2974074 by hitfactory: Error submitting configuration form when...
svenryen’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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