Skip to content

Instantly share code, notes, and snippets.

@LionsAd
Created April 7, 2019 18:16
Show Gist options
  • Select an option

  • Save LionsAd/60b2fa2fcc602405010c1b075b1bb41a to your computer and use it in GitHub Desktop.

Select an option

Save LionsAd/60b2fa2fcc602405010c1b075b1bb41a to your computer and use it in GitHub Desktop.
CFBackendPatch.diff
diff --git a/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php b/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
--- a/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
+++ b/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
@@ -46,6 +46,9 @@ public function __construct($root, $site_path, CacheTagsChecksumInterface $check
else {
$this->backendClass = 'Drupal\Core\Cache\Apcu4Backend';
}
+
+ $this->backendClass = 'Drupal\Core\Cache\CFAwareApcuBackend';
+ //$this->backendClass = 'Drupal\Core\Cache\ShmBackend';
}
/**
diff --git a/web/core/lib/Drupal/Core/Cache/ChainedFastBackend.php b/web/core/lib/Drupal/Core/Cache/ChainedFastBackend.php
--- a/web/core/lib/Drupal/Core/Cache/ChainedFastBackend.php
+++ b/web/core/lib/Drupal/Core/Cache/ChainedFastBackend.php
@@ -166,7 +166,10 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) {
$cache[$item->cid] = $item;
// Don't write the cache tags to the fast backend as any cache tag
// invalidation results in an invalidation of the whole fast backend.
- $this->fastBackend->set($item->cid, $item->data, $item->expire);
+ if (!$allow_invalid || $item->valid) {
+ // @todo Add interface check.
+ $this->fastBackend->set($item->cid, $item->data, $item->expire, [], $items);
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment