Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 37b6c13

Browse files
committed
Fix ChainCache declaring PatternClearable although subacaches may not have this feature. Fix #1265
1 parent 6d466d9 commit 37b6c13

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

core/src/plugins/cache.doctrine/src/PydioChainCache.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ public function setNamespace($namespace) {
7777
}
7878
}
7979

80+
/**
81+
* @return mixed
82+
*/
83+
public function allProvidersSupportPatternDeletion(){
84+
return array_reduce($this->cacheProviders, function($carry, $item){
85+
return $carry && $item instanceof PatternClearableCache;
86+
}, true);
87+
}
88+
8089
/**
8190
* @return bool
8291
*/

core/src/plugins/core.cache/AbstractCacheDriver.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ public function deleteAll($namespace){
312312
public function supportsPatternDelete($namespace)
313313
{
314314
$cacheDriver = $this->getCacheDriver($namespace);
315-
return $cacheDriver instanceof PatternClearableCache;
315+
if($cacheDriver instanceof PydioChainCache){
316+
return $cacheDriver->allProvidersSupportPatternDeletion();
317+
}else{
318+
return $cacheDriver instanceof PatternClearableCache;
319+
}
316320
}
317321

318322
/**
@@ -322,13 +326,13 @@ public function supportsPatternDelete($namespace)
322326
*/
323327
public function deleteKeyStartingWith($namespace, $id){
324328

329+
/** @var PatternClearableCache $cacheDriver */
325330
$cacheDriver = $this->getCacheDriver($namespace);
326331
if($this->requiresHttpForwarding($cacheDriver)){
327332
$this->httpDeletion[$namespace.$id.'pattern'] = ["namespace"=>$namespace, "pattern" => $id];
328333
return true;
329334
}
330-
331-
if(!($cacheDriver instanceof PatternClearableCache)){
335+
if(!$this->supportsPatternDelete($namespace)){
332336
return false;
333337
}
334338
Logger::debug("CacheDriver::Http", "Clear Pattern ".$id, ["namespace" => $namespace]);

0 commit comments

Comments
 (0)