@@ -135,7 +135,7 @@ public function __construct(array $options = [])
135135 */
136136 public function setDirectives ($ directives )
137137 {
138- return $ this ->local ->setDirectives ($ directives );
138+ $ this ->remote ->setDirectives ($ directives );
139139 }
140140
141141 /**
@@ -250,6 +250,8 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
250250 $ this ->local ->clean ();
251251 }
252252
253+ // Local cache doesn't save tags intentionally since it will cause inconsistency after flushing the cache
254+ // in multinode environment
253255 return $ this ->local ->save ($ dataToSave , $ id , [], $ specificLifetime );
254256 }
255257
@@ -260,17 +262,19 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
260262 */
261263 private function checkIfLocalCacheSpaceExceeded ()
262264 {
263- return $ this ->getFillingPercentage () >= ($ this ->_options ['cleanup_percentage ' ] ?? 95 );
265+ return $ this ->local -> getFillingPercentage () >= ($ this ->_options ['cleanup_percentage ' ] ?? 95 );
264266 }
265267
266268 /**
267269 * @inheritdoc
268270 */
269271 public function remove ($ id )
270272 {
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 ;
274278 }
275279
276280 /**
@@ -279,79 +283,79 @@ public function remove($id)
279283 public function clean ($ mode = \Zend_Cache::CLEANING_MODE_ALL , $ tags = [])
280284 {
281285 return $ this ->remote ->clean ($ mode , $ tags ) &&
282- $ this ->local ->clean ($ mode, $ tags );
286+ $ this ->local ->clean ($ mode );
283287 }
284288
285289 /**
286290 * @inheritdoc
287291 */
288292 public function getIds ()
289293 {
290- return $ this ->local ->getIds ();
294+ return $ this ->remote ->getIds ();
291295 }
292296
293297 /**
294298 * @inheritdoc
295299 */
296300 public function getTags ()
297301 {
298- return $ this ->local ->getTags ();
302+ return $ this ->remote ->getTags ();
299303 }
300304
301305 /**
302306 * @inheritdoc
303307 */
304308 public function getIdsMatchingTags ($ tags = [])
305309 {
306- return $ this ->local ->getIdsMatchingTags ($ tags );
310+ return $ this ->remote ->getIdsMatchingTags ($ tags );
307311 }
308312
309313 /**
310314 * @inheritdoc
311315 */
312316 public function getIdsNotMatchingTags ($ tags = [])
313317 {
314- return $ this ->local ->getIdsNotMatchingTags ($ tags );
318+ return $ this ->remote ->getIdsNotMatchingTags ($ tags );
315319 }
316320
317321 /**
318322 * @inheritdoc
319323 */
320324 public function getIdsMatchingAnyTags ($ tags = [])
321325 {
322- return $ this ->local ->getIdsMatchingAnyTags ($ tags );
326+ return $ this ->remote ->getIdsMatchingAnyTags ($ tags );
323327 }
324328
325329 /**
326330 * @inheritdoc
327331 */
328332 public function getFillingPercentage ()
329333 {
330- return $ this ->local ->getFillingPercentage ();
334+ return $ this ->remote ->getFillingPercentage ();
331335 }
332336
333337 /**
334338 * @inheritdoc
335339 */
336340 public function getMetadatas ($ id )
337341 {
338- return $ this ->local ->getMetadatas ($ id );
342+ return $ this ->remote ->getMetadatas ($ id );
339343 }
340344
341345 /**
342346 * @inheritdoc
343347 */
344348 public function touch ($ id , $ extraLifetime )
345349 {
346- return $ this ->local ->touch ($ id , $ extraLifetime );
350+ return $ this ->remote ->touch ($ id , $ extraLifetime );
347351 }
348352
349353 /**
350354 * @inheritdoc
351355 */
352356 public function getCapabilities ()
353357 {
354- return $ this ->local ->getCapabilities ();
358+ return $ this ->remote ->getCapabilities ();
355359 }
356360
357361 /**
0 commit comments