Skip to content
Snippets Groups Projects

add a test and workaround

2 files
+ 34
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 14
1
@@ -127,6 +127,16 @@ abstract class CacheBase implements CacheBackendInterface {
$this->setPermTtl();
}
/**
* Returns the CID for the last write timestamp cache.
*
* @return string
* The last write timestamp CID.
*/
public function getLastWriteCid(): string {
return ChainedFastBackend::LAST_WRITE_TIMESTAMP_PREFIX . 'cache_' . $this->bin;
}
/**
* Checks whether the cache id is the last write timestamp.
*
@@ -142,7 +152,7 @@ abstract class CacheBase implements CacheBackendInterface {
* @return bool
*/
protected function isLastWriteTimestamp(string $cid): bool {
return $cid === ChainedFastBackend::LAST_WRITE_TIMESTAMP_PREFIX . 'cache_' . $this->bin;
return $cid === $this->getLastWriteCid();
}
/**
@@ -488,6 +498,9 @@ abstract class CacheBase implements CacheBackendInterface {
usleep(1000);
$this->lastDeleteAll = round(microtime(TRUE), 3);
$this->client->set($this->getKey(static::LAST_DELETE_ALL_KEY), $this->lastDeleteAll);
// Also delete the last write timestamp in case the bin is accessed directly.
$this->client->del($this->getPrefix() . ':' . $this->getLastWriteCid());
}
}
Loading