Skip to content

Conversation

@mongeron
Copy link

@mongeron mongeron commented Dec 1, 2021

Question Answer
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? composer test -> Command "test" is not defined -> couldn't run
Fixed tickets -
License MIT
Doc PR reference to the documentation PR, if any

Description

As https://www.php.net/manual/en/function.apcu-store.php tells, apcu_store() accepts mixed as 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.serializer

One 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 using igbinary serializer, 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

  • Add tests
  • Add documentation
  • Updated Changelog.md

@mongeron mongeron changed the title Remove not needed serialize / unserialize APCu - Remove not needed serialize / unserialize Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant