Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 406a49b

Browse filesBrowse files
committed
minor #13718 [Cache] Added max items and max lifetime options to Array cache (javiereguiluz)
This PR was squashed before being merged into the 5.1 branch. Discussion ---------- [Cache] Added max items and max lifetime options to Array cache Fixes #12993. Commits ------- 3dc9899 [Cache] Added max items and max lifetime options to Array cache
2 parents 11dcebf + 3dc9899 commit 406a49b
Copy full SHA for 406a49b

File tree

1 file changed

+14
-5
lines changed
Filter options

1 file changed

+14
-5
lines changed

‎components/cache/adapters/array_cache_adapter.rst

Copy file name to clipboardExpand all lines: components/cache/adapters/array_cache_adapter.rst
+14-5Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ Array Cache Adapter
88
Generally, this adapter is useful for testing purposes, as its contents are stored in memory
99
and not persisted outside the running PHP process in any way. It can also be useful while
1010
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::
11+
method::
1512

1613
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1714

@@ -23,5 +20,17 @@ toggles serialization as its second parameter::
2320
$defaultLifetime = 0,
2421

2522
// if ``true``, the values saved in the cache are serialized before storing them
26-
$storeSerialized = true
23+
$storeSerialized = true,
24+
25+
// the maximum lifetime (in seconds) of the entire cache (after this time, the
26+
// entire cache is deleted to avoid stale data from consuming memory)
27+
$maxLifetime = 0,
28+
29+
// the maximum number of items that can be stored in the cache. When the limit
30+
// is reached, cache follows the LRU model (least recently used items are deleted)
31+
$maxItems = 0
2732
);
33+
34+
.. versionadded:: 5.1
35+
36+
The ``maxLifetime`` and ``maxItems`` options were introduced in Symfony 5.1.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.