Problem/Motivation
Using Method #1 and saving a Article with a tags field with shs module and Redis. ConsistentCacheBase::matchKey is returning the same result for each key.
To reproduce I create more than 1 new tag and save the node, seems one term doesn't have a problem and I think shs is just priming it's own cache with a shs.module:828, shs_term_get_children() which calls taxonomy_term_load_multiple().
Then after the all the entities are the same, everything busts from there and end with an error page about entity_label() can't get bundle... nice rabbit hole to fall down:)

Proposed resolution
Maybe don't use strpos() on integers? My only wild guess here because this code is beyond me.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #1
joelpittetYeah from the screenshot this evaluates to TRUE. I think both sides need to be cast to strings. I'll give that a try and post a patch but just some rough though noting here:
http://3v4l.org/fG06S
Comment #2
joelpittetThis resolved it for me and should be a tiny bit faster if they are exact matches.
Comment #3
gielfeldt commentedThanks. Nice catch. I wonder if this is actually what caused the problem for you with ConsistentCacheLookup as well. It seems to suffer from the same issue, although the symptom was a bit different.
Comment #6
gielfeldt commentedI've added your fix, and I've also added the fix to the CacheConsistentLookup class. I've also added test-cases for the issue.
Please let me know if it works. And if possible, please let me know if the CacheConsistentLookup is now fixed wrt #2530334: Notice: Undefined offset: 92 in ConsistentCacheBuffer->lookup() (line 179 of cache_consistent/cache_consistent.lookup.inc).
Comment #7
joelpittetThanks @gielfeldt, not sure which one I should stick with but for now it's not the lookup. The lookup did sound better for me with this commerce + redis site but I don't know...
Comment #8
gielfeldt commentedOk. Just let me know if the regular one works, if possible. The lookup version is probably only better on paper anyways :-)
Comment #9
joelpittetWell I have one weird problem with cache loosing property info for commerce_line_item bundles but I don't think it's related to this class (yet...).
So far 24 hours of goodness.
:)
Comment #10
joelpittetRan into a bunch of these in my local logs just now:
Should that be possible? And if so, then I guess we need to check
$key !== ''?Comment #11
gielfeldt commentedDarn it. It is possible, if someone calls cache_set or cache_clear_all with an "" for cid. Which I have encountered before. And by looking at the code, the only way I can see that this warning should occur, is if indeed someone calls cache_set or cache_clear_all with an "" for cid. But you never know ...
If you're on a local setup, could you perhaps check do some debugging in line 260 and 292, and check if someone is actually performing cache-operations with empty string cache ids?
Comment #12
gielfeldt commentedWait a minute ... cache_clear_all() accepts an empty $cid, of course. I think the check you propose might suffice as a fix. I'll get back to you.
Comment #13
gielfeldt commentedLooks like I need some extra logic for handling cache flushes...
Comment #14
joelpittetYay, extra logics!
Comment #15
gielfeldt commentedHoly mother of God, I may have to refactor quite a bit :-(
Comment #16
gielfeldt commentedI've fixed some bugs regarding flushes and minimum cache lifetime. I've also added more tests, that should cover the issues we've seen. Could you try out the latest dev-version?
After the refactoring the buffering logic became a bit more complex, making me consider I might phase out the regular class, so that it's only the lookup version that remains.
Also, the syntax of the configuration has changed:
If I remove the regular buffering class, the default buffer class will become "ConsistentCacheBufferAdvanced", so that line 2 above will be unnecessary.
If it works, I may also refactor some of the naming ("cache consistent" vs "consistent cache") before a next release candidate.
Comment #17
gielfeldt commentedComment #18
joelpittetWhy was the configuration needing to change?
I'll see if I can give this a try today but a bit leary to put large changes in production with commerce without having at least another person testing(besides you who wrote the fixes).
Comment #19
joelpittetyou may want to put
php = 5.3in the info file because I noticed you were using__DIR__magic constant and it was introduced then.Comment #20
gielfeldt commentedThx for the heads up. I might change it to dirname(__FILE__) instead though.
The configuration didn't need to change as such, but I generalised the buffer classes, so that I could easier maintain them. In any case, I will most likely remove the simple class, so the configuration (when I'm done) will just be:
Also, currently in the dev-version, using:
is equivalent to:
But that will change.
Comment #21
joelpittetWell, just updating to latest -dev this seemed to fix an issue where some menu items went missing... correlation maybe but that was nice to see:)
Should
$conf['cache_default_class'] = 'ConsistentCache';still work with the latest -dev if I don't want to use the lookup?Comment #22
gielfeldt commentedYes, that should still work.
Comment #23
gielfeldt commentedwrt menus, was the problem you had somewhat similar to this one? #2469925: Child menu items disappear
Comment #24
joelpittetYes I think that is the problem it sounds very very similar.
Comment #25
gielfeldt commentedI've merged my refactoring into 7.x-2.x-dev.
I've removed the Lookup class. You now only need to:
Comment #26
joelpittetThanks, I'll upgrade.
Comment #27
joelpittetNoticed this in my logs regarding a elysia cron job. It may not be a problem here but should probably be checked into.
Notice: Undefined offset: 76 in ConsistentCacheBuffer->lookup() (line 280 of cache_consistent/cache_consistent.buffer.inc).Comment #28
gielfeldt commentedI have a hard time reproducing this. But I have a theory. Could you try to remove or comment line 327 in cache_consistent.buffer.inc ? And see if that eliminates the warning.
Comment #29
gielfeldt commentedNevermind. I found the bug.
Comment #30
gielfeldt commentedThere. Could you try the latest dev version? Again :-)
Comment #31
joelpittetThanks, I'll give it a try.
Should I worry about this change?
Comment #32
gielfeldt commentedNo, it was just a performance optimisation that wasn't working as well as it should. So I removed it. I've since then re-implemented it so that it works better, but I haven't pushed it to the dev-branch yet.
Comment #33
joelpittetSo it seems to be throwing notices, but to the end user on admin_menu cache clears it's showing like an exception error.Notice: Undefined offset: 42 in ConsistentCacheBuffer->lookup() (line 280 of cache_consistent/cache_consistent.buffer.inc)I noticed no new changes have been made since yesterday when I applied that so I assume this is from the new changes.
Edit: before patch applied.
Comment #34
joelpittetWhoops, hold up didn't push my changes live yet. Just did that... ignore #33
Comment #35
gielfeldt commentedNo news is good news, I hope? Since last time, I've fixed a couple of edge-cases, which you probably haven't run into. I'm gonna merge them into 2.x-dev tonight.
Comment #36
joelpittetNo news is good news:) squeaky logs get the grease.
Comment #37
gielfeldt commentedDev-version is now up-to-date with the latest fixes. Hopefully we're nearing/at the end now.
Comment #38
gielfeldt commentedComment #39
joelpittetDo you need more info from me? How are you using "Postponed (maintainer needs more info)"?
Comment #40
gielfeldt commentedSorry, I missed this. I was just wondering if we could call this one closed.
Comment #41
joelpittetYes
Comment #42
joelpittetWhoops