@@ -135,7 +135,7 @@ public function __construct(array $options = [])
135
135
*/
136
136
public function setDirectives ($ directives )
137
137
{
138
- return $ this ->local ->setDirectives ($ directives );
138
+ $ this ->remote ->setDirectives ($ directives );
139
139
}
140
140
141
141
/**
@@ -250,6 +250,8 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
250
250
$ this ->local ->clean ();
251
251
}
252
252
253
+ // Local cache doesn't save tags intentionally since it will cause inconsistency after flushing the cache
254
+ // in multinode environment
253
255
return $ this ->local ->save ($ dataToSave , $ id , [], $ specificLifetime );
254
256
}
255
257
@@ -260,17 +262,19 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
260
262
*/
261
263
private function checkIfLocalCacheSpaceExceeded ()
262
264
{
263
- return $ this ->getFillingPercentage () >= ($ this ->_options ['cleanup_percentage ' ] ?? 95 );
265
+ return $ this ->local -> getFillingPercentage () >= ($ this ->_options ['cleanup_percentage ' ] ?? 95 );
264
266
}
265
267
266
268
/**
267
269
* @inheritdoc
268
270
*/
269
271
public function remove ($ id )
270
272
{
271
- return $ this ->removeRemoteDataVersion ($ id ) &&
272
- $ this ->remote ->remove ($ id ) &&
273
- $ this ->local ->remove ($ id );
273
+ $ result = $ this ->removeRemoteDataVersion ($ id ) && $ this ->remote ->remove ($ id );
274
+ if ($ result && !$ this ->_options ['use_stale_cache ' ]) {
275
+ $ result = $ this ->local ->remove ($ id );
276
+ }
277
+ return $ result ;
274
278
}
275
279
276
280
/**
@@ -279,79 +283,79 @@ public function remove($id)
279
283
public function clean ($ mode = \Zend_Cache::CLEANING_MODE_ALL , $ tags = [])
280
284
{
281
285
return $ this ->remote ->clean ($ mode , $ tags ) &&
282
- $ this ->local ->clean ($ mode, $ tags );
286
+ $ this ->local ->clean ($ mode );
283
287
}
284
288
285
289
/**
286
290
* @inheritdoc
287
291
*/
288
292
public function getIds ()
289
293
{
290
- return $ this ->local ->getIds ();
294
+ return $ this ->remote ->getIds ();
291
295
}
292
296
293
297
/**
294
298
* @inheritdoc
295
299
*/
296
300
public function getTags ()
297
301
{
298
- return $ this ->local ->getTags ();
302
+ return $ this ->remote ->getTags ();
299
303
}
300
304
301
305
/**
302
306
* @inheritdoc
303
307
*/
304
308
public function getIdsMatchingTags ($ tags = [])
305
309
{
306
- return $ this ->local ->getIdsMatchingTags ($ tags );
310
+ return $ this ->remote ->getIdsMatchingTags ($ tags );
307
311
}
308
312
309
313
/**
310
314
* @inheritdoc
311
315
*/
312
316
public function getIdsNotMatchingTags ($ tags = [])
313
317
{
314
- return $ this ->local ->getIdsNotMatchingTags ($ tags );
318
+ return $ this ->remote ->getIdsNotMatchingTags ($ tags );
315
319
}
316
320
317
321
/**
318
322
* @inheritdoc
319
323
*/
320
324
public function getIdsMatchingAnyTags ($ tags = [])
321
325
{
322
- return $ this ->local ->getIdsMatchingAnyTags ($ tags );
326
+ return $ this ->remote ->getIdsMatchingAnyTags ($ tags );
323
327
}
324
328
325
329
/**
326
330
* @inheritdoc
327
331
*/
328
332
public function getFillingPercentage ()
329
333
{
330
- return $ this ->local ->getFillingPercentage ();
334
+ return $ this ->remote ->getFillingPercentage ();
331
335
}
332
336
333
337
/**
334
338
* @inheritdoc
335
339
*/
336
340
public function getMetadatas ($ id )
337
341
{
338
- return $ this ->local ->getMetadatas ($ id );
342
+ return $ this ->remote ->getMetadatas ($ id );
339
343
}
340
344
341
345
/**
342
346
* @inheritdoc
343
347
*/
344
348
public function touch ($ id , $ extraLifetime )
345
349
{
346
- return $ this ->local ->touch ($ id , $ extraLifetime );
350
+ return $ this ->remote ->touch ($ id , $ extraLifetime );
347
351
}
348
352
349
353
/**
350
354
* @inheritdoc
351
355
*/
352
356
public function getCapabilities ()
353
357
{
354
- return $ this ->local ->getCapabilities ();
358
+ return $ this ->remote ->getCapabilities ();
355
359
}
356
360
357
361
/**
0 commit comments