md-systems/redis

drupal cache not cleared properly with drush cr

sukanyaramakrishnan opened this issue · 8 comments

Hello,

we use redis as caching backend and i found that the cache is not cleared fully while running the drush cr command. To be specific, the field definitions for entities were still being pulled from the cache which should have been cleared with my previous drush cr command.

You're most likely running into #8. Set a specific prefix and it should work fine. You're more than welcome to work on a PR for porting the implementation from 7.x-3.x

Berdir,

we are already using the set prefix but still seeing this issue? any ideas?

The only other reason I can think of is that if the apc(u) extension isn't enabled, then maybe drush doesn't clear the fast chained caches. but the same would then happen when using the database backedn.

Berdir,

Thanks for your reply. i wonder if apc is the reason,because my problem of the cache not getting cleared with drush cr went away when i used redis-cli flushall, thats why i posted the issue here.

Thanks,
Sukanya

Berdir,

here is a finding from one of my team members.. thought i will update you to see if it can help.

It looks like the clear is partially working as expected. What is happening is that the keys are being set to expire, not deleted (like a flushall would do) the problem is the expiry time is set to 31536000 seconds or 1yr so basically they wont expire.
1466013644.947913 [0 127.0.0.1:35507] "EXPIRE" ":config:page_manager.page_variant.<test_page>" "31536000"

Those cache entries do not have an expiration date, so that is correct. expiration is something different. The database backend uses -1 for those, but that's not possible for redis, so we use 1y for it

Berdir,
Those entries are for sure not being deleted and they should be deleted when drush cr is run right?
what would be the reason for the keys not being deleted?
regards
Sukanya

No, the keys are not deleted. Redis has no concept of cache bins, you can't easily get a list of all cache entries in a cache bin, it's just a prefix. Instead, a separate cache entry tracks the last deleteAll() for a cache bin.

However, that shouldn't matter as long as you have a common cache prefix. Check with keys or so in redis, do you really only see a single prefix?

Also, I'm closing this issue as redis now finally moved back to drupal.org. If you still have problems, create an issue there instead.