Closed VIS89 closed 2 years ago
I know, currently it just shows a plain unformatted value. This is definitely something that needs to be improved.
gzipkey.txt Here's the key in txt format. Thanks for a great job!
Hey, sorry to reopen the task. Just tested it, here's the result.
What the heck is this compression lol. I tried the standard gzcompress()
, gzencode()
, gzdeflate()
and these work fine.
I need to check Magento source code. If this is from it.
I can help you if you need more info, just let me know. You can write me here or email me.
Got it, Magento uses this library https://github.com/colinmollenhour/Cm_Cache_Backend_Redis
And here is code for decoding https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/master/Cm/Cache/Backend/Redis.php#L1315
It uses standard gzuncompress() as well but with prefix..
Small update:
I don't want any system-specific codes in this app, so add this into 'encoding' => []
section in your config.php file
'gz_magento' => [
'view' => static function (string $value): ?string {
// https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/blob/master/Cm/Cache/Backend/Redis.php#L1306-L1323
if (strpos($value, "gz:\x1f\x8b") === 0) {
$value = substr($value, 5);
}
return @gzuncompress($value) !== false ? gzuncompress($value) : null;
},
'save' => static fn (string $value): string => "gz:\x1f\x8b".gzcompress($value),
],
The reason is simple, app now allows people to add their own encoding/decoding functions, so there's no reason to have it there by default. Also not everyone uses Magento.
Hello, We faced an issue viewing the key where the info is gunzipped/encoded. Would be very nice if you support some decompress/decode methods by default. I see some desktop software support that. Uploading an example. If you like I can also upload the redis key. Just for your information, that's a stored key from Magento 2.4 redis backend cache.