APCu - Remove not needed serialize / unserialize#252
Open
mongeron wants to merge 1 commit intophp-cache:masterfrom
Open
APCu - Remove not needed serialize / unserialize#252mongeron wants to merge 1 commit intophp-cache:masterfrom
mongeron wants to merge 1 commit intophp-cache:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
composer test->Command "test" is not defined-> couldn't runDescription
As https://www.php.net/manual/en/function.apcu-store.php tells,
apcu_store()acceptsmixedas variable type. APCu module performs serialization / unserialization internally. The serializer to use is configured as APCu module runtime configuration: https://www.php.net/manual/en/apcu.configuration.php#ini.apcu.serializerOne alternative serializer is https://www.php.net/manual/en/intro.igbinary.php, which uses more efficient encoding for serialization than the standard PHP text serialization.
If the cache adapter serializes
apc_store()values, there is no benefit in usingigbinaryserializer, because the input is always text.As a summary: There is no need to serialize / unserialize input / output from cache. It adds the overhead of second serialize and deserialize calls, and cripples optimisations from improved serialzers.
Personally I have used APCu functionality without serialization for years in production environment without any issues.
This change shouldn't need any additional tests. I assume the store / fetch correctness is tested in existing tests.
TODO