@@ -11,6 +11,10 @@ standard, but need to pass it to an object that expects a :ref:`PSR-6 <cache-com
11
11
cache adapter. Or, you might have the opposite situation. The cache component contains
12
12
two classes for bidirectional interoperability between PSR-6 and PSR-16 caches.
13
13
14
+ .. versionadded :: 4.3
15
+
16
+ The ``Psr16Adapter `` and ``Psr16Cache `` classes mentionned below were added in Symfony 4.3.
17
+
14
18
Using a PSR-16 Cache Object as a PSR-6 Cache
15
19
--------------------------------------------
16
20
@@ -33,17 +37,15 @@ example::
33
37
34
38
But, you already have a PSR-16 cache object, and you'd like to pass this to the class
35
39
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
37
41
this use-case::
38
42
39
- use Symfony\Component\Cache\Adapter\SimpleCacheAdapter;
40
- use Symfony\Component\Cache\Simple\FilesystemCache;
43
+ use Symfony\Component\Cache\Adapter\Psr16Adapter;
41
44
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
44
46
45
47
// a PSR-6 cache that uses your cache internally!
46
- $psr6Cache = new SimpleCacheAdapter ($psr16Cache);
48
+ $psr6Cache = new Psr16Adapter ($psr16Cache);
47
49
48
50
// now use this wherever you want
49
51
$githubApiClient = new GitHubApiClient($psr6Cache);
@@ -70,11 +72,11 @@ example::
70
72
71
73
But, you already have a PSR-6 cache pool object, and you'd like to pass this to
72
74
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
74
76
this use-case::
75
77
76
78
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
77
- use Symfony\Component\Cache\Simple\Psr6Cache ;
79
+ use Symfony\Component\Cache\Psr16Cache ;
78
80
79
81
// the PSR-6 cache object that you want to use
80
82
$psr6Cache = new FilesystemAdapter();
0 commit comments