Skip to content

Commit 6d8390c

Browse files
[Cache] Update for 4.3
1 parent 9d34ea0 commit 6d8390c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

components/cache/psr6_psr16_adapters.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ standard, but need to pass it to an object that expects a :ref:`PSR-6 <cache-com
1111
cache adapter. Or, you might have the opposite situation. The cache component contains
1212
two classes for bidirectional interoperability between PSR-6 and PSR-16 caches.
1313

14+
.. versionadded:: 4.3
15+
16+
The ``Psr16Adapter`` and ``Psr16Cache`` classes mentionned below were added in Symfony 4.3.
17+
1418
Using a PSR-16 Cache Object as a PSR-6 Cache
1519
--------------------------------------------
1620

@@ -33,17 +37,15 @@ example::
3337

3438
But, you already have a PSR-16 cache object, and you'd like to pass this to the class
3539
instead. No problem! The Cache component provides the
36-
:class:`Symfony\\Component\\Cache\\Adapter\\SimpleCacheAdapter` class for exactly
40+
:class:`Symfony\\Component\\Cache\\Adapter\\Psr16Adapter` class for exactly
3741
this use-case::
3842

39-
use Symfony\Component\Cache\Adapter\SimpleCacheAdapter;
40-
use Symfony\Component\Cache\Simple\FilesystemCache;
43+
use Symfony\Component\Cache\Adapter\Psr16Adapter;
4144

42-
// the PSR-16 cache object that you want to use
43-
$psr16Cache = new FilesystemCache();
45+
// $psr16Cache is the PSR-16 object that you want to use as a PSR-6 one
4446

4547
// a PSR-6 cache that uses your cache internally!
46-
$psr6Cache = new SimpleCacheAdapter($psr16Cache);
48+
$psr6Cache = new Psr16Adapter($psr16Cache);
4749

4850
// now use this wherever you want
4951
$githubApiClient = new GitHubApiClient($psr6Cache);
@@ -70,11 +72,11 @@ example::
7072

7173
But, you already have a PSR-6 cache pool object, and you'd like to pass this to
7274
the class instead. No problem! The Cache component provides the
73-
:class:`Symfony\\Component\\Cache\\Simple\\Psr6Cache` class for exactly
75+
:class:`Symfony\\Component\\Cache\\Psr16Cache` class for exactly
7476
this use-case::
7577

7678
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
77-
use Symfony\Component\Cache\Simple\Psr6Cache;
79+
use Symfony\Component\Cache\Psr16Cache;
7880

7981
// the PSR-6 cache object that you want to use
8082
$psr6Cache = new FilesystemAdapter();

0 commit comments

Comments
 (0)