File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
components/cache/adapters Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 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+ );
You can’t perform that action at this time.
0 commit comments