Skip to content

Commit 0aacabb

Browse files
committed
minor #17348 [Cache] Reword "max lifetime" to "default lifetime" (colinodell)
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] Reword "max lifetime" to "default lifetime" The use of the word "maximum" here is not very clear; it's easy for somebody to mistakenly believe that this parameter limits the TTL of the higher caches to some maximum value. For example, if the second cache returns a hit with a TTL of 3600, then `$maxLifetime = 60` would mean the first cache should use a TTL of 60 since that's the "maximum lifetime". But looking at the code, that's not what happens - this parameter actually works as a **default** TTL for items without an expiry. I believe this possible confusion is why the variable was renamed in [#26984](symfony/symfony#26984) so let's update the documentation accordingly. Hopefully this will prevent others from making the same misunderstandings that I did :) Commits ------- e1c8dc8 Reword "max lifetime" to "default lifetime"
2 parents 6a369b3 + e1c8dc8 commit 0aacabb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/cache/adapters/chain_adapter.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This adapter allows combining any number of the other
1212
fetched from the first adapter containing them and cache items are saved to all the
1313
given adapters. This exposes a simple and efficient method for creating a layered cache.
1414

15-
The ChainAdapter must be provided an array of adapters and optionally a maximum cache
15+
The ChainAdapter must be provided an array of adapters and optionally a default cache
1616
lifetime as its constructor arguments::
1717

1818
use Symfony\Component\Cache\Adapter\ChainAdapter;
@@ -21,8 +21,8 @@ lifetime as its constructor arguments::
2121
// The ordered list of adapters used to fetch cached items
2222
array $adapters,
2323

24-
// The max lifetime of items propagated from lower adapters to upper ones
25-
$maxLifetime = 0
24+
// The default lifetime of items propagated from lower adapters to upper ones
25+
$defaultLifetime = 0
2626
);
2727

2828
.. note::

0 commit comments

Comments
 (0)