discord-php / DiscordPHP

An API to interact with the popular messaging app Discord
MIT License
985 stars 236 forks source link

Allow non react/cache interface to use compress option #1025

Closed SQKo closed 1 year ago

SQKo commented 1 year ago

Previously the compress option only takes effect on react/cache interface, this PR allows other.

However it is not compatible with Symfony cache since the serialization takes place after this library serliazer(), it is however still possible to compress data by using the DeflateMarshaller from the Symfony class, and this library $compress option must be set to false, so added the warning PHP Notice: Symfony cache is not compatible with option $compress = true, Use the DeflateMarshaller to compress data! in D:\Data\DiscordPHP\src\Discord\Helpers\CacheConfig.php on line 71. Example:

$cache = new CacheConfig(new Psr16Cache(new RedisAdapter($redis, 'dphp', 0, new DeflateMarshaller(new DefaultMarshaller()))), compress: false);

Tested.