Description
Description
Sometimes we need to share the cache pools among application written in different languages, in my case I cache the redirection rules to Redis, and have my lua script loads them inside nginx to do instant redirection without having to send the request to PHP. Having the cached content serialized by PHP creates lots of unnecessary headaches. Obviously I can skip the whole cache contract by Symfony and save the redirection rules to Redis directly via my custom PHP code, but I would rather not do that if I can.
Right now I cannot see a way to skip serializer (marshaller) or perhaps providing custom serializer per cache pool at all.
Example
I think it can be as simple as:
pools:
doctrine.system_cache_pool:
adapter: cache.adapter.redis_doctrine_system
provider: cache.provider.system_redis
marshaller: marshaller.nil
or
pools:
doctrine.system_cache_pool:
adapter: cache.adapter.redis_doctrine_system
provider: cache.provider.system_redis
skip_marshall: true
(I saw this PR: #27484 which is not approved. I think my use case is a bit different however).
Edit 1:
I got around this by defining my own redis adapter and marshaller:
<service id="cache.adapter.redis_nil_marshaller" class="Symfony\Component\Cache\Adapter\RedisAdapter"
abstract="true">
<tag name="cache.pool" provider="cache.default_redis_provider" clearer="cache.default_clearer"
reset="reset"/>
<tag name="monolog.logger" channel="cache"/>
<argument/> <!-- Redis connection service -->
<argument/> <!-- namespace -->
<argument>0</argument> <!-- default lifetime -->
<argument type="service" id="cache.nil_marshaller" on-invalid="ignore"/>
<call method="setLogger">
<argument type="service" id="logger" on-invalid="ignore"/>
</call>
</service>
<service id="cache.nil_marshaller" class="MyPath\NilMarshaller">
</service>