From 3140e1c9910a992dce02ec28730c789bedd96a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lahmann?= <lahmann@users.noreply.github.com> Date: Tue, 5 Jul 2016 14:23:52 +0200 Subject: [PATCH] * adds removeCachedData() to ILS\Driver\AbstractBase to allow explicit removal of cached data (#747) --- .../src/VuFind/ILS/Driver/AbstractBase.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/module/VuFind/src/VuFind/ILS/Driver/AbstractBase.php b/module/VuFind/src/VuFind/ILS/Driver/AbstractBase.php index 563afe39c4d..55ba42d5fac 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/AbstractBase.php +++ b/module/VuFind/src/VuFind/ILS/Driver/AbstractBase.php @@ -155,4 +155,20 @@ abstract class AbstractBase implements DriverInterface ]; $this->cache->setItem($this->formatCacheKey($key), $item); } + + /** + * Helper function for removing cached data. + * + * @param string $key Cache entry key + * + * @return void + */ + protected function removeCachedData($key) + { + // Don't write to cache if we don't have a cache! + if (null === $this->cache) { + return; + } + $this->cache->removeItem($this->formatCacheKey($key)); + } } -- GitLab