Skip to content

[Cache] Igbinary extension is no longer used by default when available #20073

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

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions components/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,27 @@ Symfony uses *marshallers* (classes which implement
the cache items before storing them.

The :class:`Symfony\\Component\\Cache\\Marshaller\\DefaultMarshaller` uses PHP's
``serialize()`` or ``igbinary_serialize()`` if the `Igbinary extension`_ is installed.
There are other *marshallers* that can encrypt or compress the data before storing it::
``serialize()`` function by default, but you can optionally use the ``igbinary_serialize()``
function from the `Igbinary extension`_:

use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\DefaultMarshaller;
use Symfony\Component\Cache\DeflateMarshaller;

$marshaller = new DeflateMarshaller(new DefaultMarshaller());
// you can optionally use the Igbinary extension if you have it installed
// $marshaller = new DeflateMarshaller(new DefaultMarshaller(useIgbinarySerialize: true));

$cache = new RedisAdapter(new \Redis(), 'namespace', 0, $marshaller);

There are other *marshallers* that can encrypt or compress the data before storing it.

.. versionadded:: 7.2

In Symfony versions prior to 7.2, the ``igbinary_serialize()`` function was
used by default when the Igbinary extension was installed. Starting from
Symfony 7.2, you have to enable Igbinary support explicitly.

Advanced Usage
--------------

Expand Down
Loading