Skip to content

Commit 90ce1b2

Browse files
committed
Updates
1 parent 085b525 commit 90ce1b2

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

components/cache.rst

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,26 @@ Now you can create, retrieve, update and delete items using this cache pool::
192192

193193
For a list of all of the supported adapters, see :doc:`/components/cache/cache_pools`.
194194

195-
Serializing Data
196-
----------------
195+
Marshalling (Serializing) Data
196+
------------------------------
197197

198-
When an item is stored in the cache, it is serialised to a string. It is a class
199-
implementing :class:`Symfony\\Component\\Cache\\Marshaller\\MarshallerInterface`
200-
that is responsible for serializing and unserializing. Or to be technically correct:
201-
to ``marshall()`` and to ``unmarshall()``.
198+
.. note::
199+
200+
`Marshalling`_ and `serializing`_ are similar concepts. Serializing is the
201+
process of translating an object state into a format that can be stored
202+
(e.g. in a file). Marshalling is the process of translating both the object
203+
state and its codebase into a format that can be stored or transmitted.
204+
205+
Unmarshalling an object produces a copy of the original object, possibly by
206+
automatically loading the class definitions of the object.
207+
208+
Symfony uses *marshallers* (classes which implement
209+
:class:`Symfony\\Component\\Cache\\Marshaller\\MarshallerInterface`) to process
210+
the cache items before storing them.
202211

203-
The :class:`Symfony\\Component\\Cache\\Marshaller\\DefaultMarshaller` is using PHP's
204-
``serialize()`` or ``igbinary_serialize()`` if the Igbinary extension is installed.
205-
There are other marshallers that will encrypt or compress the data before storing it::
212+
The :class:`Symfony\\Component\\Cache\\Marshaller\\DefaultMarshaller` uses PHP's
213+
``serialize()`` or ``igbinary_serialize()`` if the `Igbinary extension`_ is installed.
214+
There are other *marshallers* that can encrypt or compress the data before storing it::
206215

207216
use Symfony\Component\Cache\Adapter\RedisAdapter;
208217
use Symfony\Component\Cache\DefaultMarshaller;
@@ -224,3 +233,6 @@ Advanced Usage
224233
.. _`Cache Contracts`: https://github.com/symfony/contracts/blob/master/Cache/CacheInterface.php
225234
.. _`Stampede prevention`: https://en.wikipedia.org/wiki/Cache_stampede
226235
.. _Probabilistic early expiration: https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration
236+
.. _`Marshalling`: https://en.wikipedia.org/wiki/Marshalling_(computer_science)
237+
.. _`serializing`: https://en.wikipedia.org/wiki/Serialization
238+
.. _`Igbinary extension`: https://github.com/igbinary/igbinary

0 commit comments

Comments
 (0)