Cm_Cache_Backend_Redis icon indicating copy to clipboard operation
Cm_Cache_Backend_Redis copied to clipboard

Remove set instead of removing set members if only one tag

Open joshua-bn opened this issue 5 years ago • 1 comments

https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/1132d905f08e33f24d1d80b775d2c7720b00c239/Cm/Cache/Backend/Redis.php#L748

If we only have one cache tag (I think that's the usual case, at least for Magento), we can just remove this instead of removing the set members, right?

joshua-bn avatar Sep 27 '20 18:09 joshua-bn

The _notMatchingTags flag is disabled by default so this code would not have any effect unless it is enabled by the user. When enabled it keeps track of all ids in a separate set so that it is efficient to do a "not matching tags" cache clear. Otherwise it would be very time consuming to get all ids. This is a lot of overhead though which is why it's disabled by default.

I've seen plenty of cases where there are multiple tags used so I don't think any such assumptions can be made safely, at least not for a general-purpose library.

colinmollenhour avatar Sep 28 '20 19:09 colinmollenhour