8000 Merge branch '5.1' · symfony/symfony-docs@72e6a58 · GitHub
[go: up one dir, main page]

Skip to content

Commit 72e6a58

Browse files
committed
Merge branch '5.1'
* 5.1: [Cache] Added max items and max lifetime options to Array cache [String] Allow to define additional slugger substitutions
2 parents 78d6914 + 406a49b commit 72e6a58

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

components/cache/adapters/array_cache_adapter.rst

Lines 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.

components/string.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,15 @@ that only includes safe ASCII characters::
468468
$slug = $slugger->slug('Wôrķšƥáçè ~~sèťtïñğš~~');
469469
// $slug = 'Workspace-settings'
470470

471+
// you can also pass an array with additional character substitutions
< 7363 code>472+
$slugger = new AsciiSlugger('en', ['%' => 'percent', '€' => 'euro']);
473+
$slug = $slugger->slug('10% or 5€');
474+
// $slug = '10-percent-or-5-euro'
475+
476+
.. versionadded:: 5.1
477+
478+
The feature to define additional substitutions was introduced in Symfony 5.1.
479+
471480
The separator between words is a dash (``-``) by default, but you can define
472481
another separator as the second argument::
473482

0 commit comments

Comments
 (0)
0