Skip to content

Commit 344d572

Browse files
committed
Added code example
1 parent edf2010 commit 344d572

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

components/cache.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,14 @@ and to ``unmarshall()``.
202202

203203
The :class:`Symfony\\Component\\Cache\\Marshaller\\DefaultMarshaller` is using PHP's
204204
``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.
205+
There are other marshallers that will encrypt or compress the data before storing it::
206+
207+
use Symfony\Component\Cache\Adapter\RedisAdapter;
208+
use Symfony\Component\Cache\DefaultMarshaller;
209+
use Symfony\Component\Cache\DeflateMarshaller;
210+
211+
$marshaller = new DeflateMarshaller(new DefaultMarshaller());
212+
$cache = new RedisAdapter(new \Redis(), 'namespace', 0, $marshaller);
206213

207214
Advanced Usage
208215
--------------

0 commit comments

Comments
 (0)