Cm_Cache_Backend_Redis
Cm_Cache_Backend_Redis copied to clipboard
diffiniate empty cache entry and non-existing cache entry
https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/3fc3e9149097f67cded1c425088e37d7fa8083ed/Cm/Cache/Backend/Redis.php#L513
Look like if we save a cache entry with empty content then when we load, it is treated as non-existing cache entry so this makes some wrong logic in application usages. It would be considered as a bug or we can't do anything in this case? @colinmollenhour
So if you save an empty string you get false? Seems that could be an issue with save then rather than load?
@colinmollenhour no, saving return true as expected. It should be an issue with load
I did not state my question well.. I meant, if you save an empty string and then load that key, you get false?
Please provide steps to produce, expected result and actual result for clarity.
Yes, exactly, this is used and tested in a context of Magento 2 project.
My system is messed up at the moment.. as a workaround you could use the test() method to check for existence of a key regardless of if it was empty or not.
Thanks, currently I can avoid using empty block or empty cache on the project. I just wanted to report the bug because in some cases, it can cause performance or other issues.