-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Use igbinary when available #19895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We need to be careful here the ability to read an existing cache will depend on the igbinary availability (think cache warming on a different machine than the one where it is installed). |
I agree with Fabien. Using "igbinary" automatically when it's available on the server feels too magic for Symfony. It'd be better to add a config option to enable this feature explicitly. |
@javiereguiluz @fabpot 👍 |
I think it's possible to have autoadaptative behavior. |
I have pool of large generated object trees (over 1k trees). Each request uses only one tree from the pool, so using opcache is memory inefficient and using memcache/redis would increase network load. I using file-based cache with igbinary serialization. In attempt to migrate to Symfony's Cache component I finds it hard to extend Symfony's implementations to replace serialization parts. |
There are no plans, but there could be PRs :) |
I'm going to add MarshallerInterface. |
I'd call it |
I renamed it to SerializerInterface and added some tests. Also I did heavy refactoring on opcache related caches. |
If that could make your work easier, not all adapters should have a configurable serializer IMHO. The opcache ones don't need to especially. |
I'm done with refactoring. Should I submit it with new feature PR? |
Yes please |
…he serializer, providing a default one that automatically uses igbinary when available (nicolas-grekas) This PR was merged into the 4.2-dev branch. Discussion ---------- [Cache] Add `MarshallerInterface` allowing to change the serializer, providing a default one that automatically uses igbinary when available | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #19895 | License | MIT | Doc PR | - With this PR, when igbinary is available, it is automatically used to serialize values. This provides faster and smaller cache payloads. The unserializing logic is autoadaptative: - when an igbinary-serialized value is unserialized but the extension is missing, a cache miss is triggered - when a natively-serialized value is unserialized and the extension is available, the native `unserialize()` is used Ping @palex-fpt since you provided very useful comments on the topic and might be interested in reviewing here also. Commits ------- 9c328c4 [Cache] Add `MarshallerInterface` allowing to change the serializer, providing a default one that automatically uses igbinary when available
So that cached items take less space on the storage backend.
See igbinary/igbinary#76 also.
The text was updated successfully, but these errors were encountered: