You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -47,49 +47,6 @@ $client = new Client(['handler' => $stack]);
47
47
48
48
# Examples
49
49
50
-
## Doctrine/Cache
51
-
You can use a cache from `Doctrine/Cache`:
52
-
```php
53
-
[...]
54
-
use Doctrine\Common\Cache\FilesystemCache;
55
-
use Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy;
56
-
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;
57
-
58
-
[...]
59
-
$stack->push(
60
-
new CacheMiddleware(
61
-
new PrivateCacheStrategy(
62
-
new DoctrineCacheStorage(
63
-
new FilesystemCache('/tmp/')
64
-
)
65
-
)
66
-
),
67
-
'cache'
68
-
);
69
-
```
70
-
71
-
You can use `ChainCache` for using multiple `CacheProvider` instances. With that provider, you have to sort the different caches from the faster to the slower. Like that, you can have a very fast cache.
72
-
```php
73
-
[...]
74
-
use Doctrine\Common\Cache\ChainCache;
75
-
use Doctrine\Common\Cache\ArrayCache;
76
-
use Doctrine\Common\Cache\FilesystemCache;
77
-
use Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy;
78
-
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;
79
-
80
-
[...]
81
-
$stack->push(new CacheMiddleware(
82
-
new PrivateCacheStrategy(
83
-
new DoctrineCacheStorage(
84
-
new ChainCache([
85
-
new ArrayCache(),
86
-
new FilesystemCache('/tmp/'),
87
-
])
88
-
)
89
-
)
90
-
), 'cache');
91
-
```
92
-
93
50
## Laravel cache
94
51
You can use a cache with Laravel, e.g. Redis, Memcache etc.:
95
52
```php
@@ -155,19 +112,20 @@ $stack->push(
155
112
It's possible to add a public shared cache to the stack:
156
113
```php
157
114
[...]
158
-
use Doctrine\Common\Cache\FilesystemCache;
159
-
use Doctrine\Common\Cache\PredisCache;
115
+
use Cache\Adapter\PHPArray\ArrayCachePool;
160
116
use Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy;
161
117
use Kevinrob\GuzzleCache\Strategy\PublicCacheStrategy;
162
-
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;
118
+
use Kevinrob\GuzzleCache\Storage\Psr6CacheStorage;
119
+
use League\Flysystem\Local\LocalFilesystemAdapter;
120
+
use Kevinrob\GuzzleCache\Storage\FlysystemStorage;
163
121
164
122
[...]
165
123
// Private caching
166
124
$stack->push(
167
125
new CacheMiddleware(
168
126
new PrivateCacheStrategy(
169
-
new DoctrineCacheStorage(
170
-
new FilesystemCache('/tmp/')
127
+
new FlysystemStorage(
128
+
new LocalFilesystemAdapter('/tmp/')
171
129
)
172
130
)
173
131
),
@@ -178,10 +136,8 @@ $stack->push(
178
136
$stack->push(
179
137
new CacheMiddleware(
180
138
new PublicCacheStrategy(
181
-
new DoctrineCacheStorage(
182
-
new PredisCache(
183
-
new Predis\Client('tcp://10.0.0.1:6379')
184
-
)
139
+
new Psr6CacheStorage(
140
+
new ArrayCachePool()
185
141
)
186
142
)
187
143
),
@@ -197,16 +153,16 @@ disregarding any possibly present caching headers:
197
153
[...]
198
154
use Kevinrob\GuzzleCache\KeyValueHttpHeader;
199
155
use Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy;
200
-
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;
201
-
use Doctrine\Common\Cache\FilesystemCache;
156
+
use Kevinrob\GuzzleCache\Storage\FlysystemStorage;
157
+
use League\Flysystem\Local\LocalFilesystemAdapter;
202
158
203
159
[...]
204
160
// Greedy caching
205
161
$stack->push(
206
162
new CacheMiddleware(
207
163
new GreedyCacheStrategy(
208
-
new DoctrineCacheStorage(
209
-
new FilesystemCache('/tmp/')
164
+
new FlysystemStorage(
165
+
new LocalFilesystemAdapter('/tmp/')
210
166
),
211
167
1800, // the TTL in seconds
212
168
new KeyValueHttpHeader(['Authorization']) // Optional - specify the headers that can change the cache key
"guzzlehttp/guzzle": "For using this library. It was created for Guzzle6 (but you can use it with any PSR-7 HTTP client).",
44
-
"doctrine/cache": "This library has a lot of ready-to-use cache storage (to be used with Kevinrob\\GuzzleCache\\Storage\\DoctrineCacheStorage). Use only versions >=1.4.0 < 2.0.0",
45
43
"league/flysystem": "To be used with Kevinrob\\GuzzleCache\\Storage\\FlysystemStorage",
46
44
"psr/cache": "To be used with Kevinrob\\GuzzleCache\\Storage\\Psr6CacheStorage",
47
45
"psr/simple-cache": "To be used with Kevinrob\\GuzzleCache\\Storage\\Psr16CacheStorage",
0 commit comments