Skip to content

Commit 075c14d

Browse files
committed
Restored the deleted adapter cache file
1 parent 208bdbd commit 075c14d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. index::
2+
single: Cache Pool
3+
single: Array Cache
4+
5+
Array Cache Adapter
6+
===================
7+
8+
Generally, this adapter is useful for testing purposes, as its contents are stored in memory
9+
and not persisted outside the running PHP process in any way. It can also be useful while
10+
warming up caches, due to the :method:`Symfony\\Component\\Cache\\Adapter\\ArrayAdapter::getValues`
11+
method.
12+
13+
This adapter can be passed a default cache lifetime as its first parameter, and a boolean that
14+
toggles serialization as its second parameter::
15+
16+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
17+
18+
$cache = new ArrayAdapter(
19+
20+
// the default lifetime (in seconds) for cache items that do not define their
21+
// own lifetime, with a value 0 causing items to be stored indefinitely (i.e.
22+
// until the current PHP process finishes)
23+
$defaultLifetime = 0,
24+
25+
// if ``true``, the values saved in the cache are serialized before storing them
26+
$storeSerialized = true
27+
);

0 commit comments

Comments
 (0)