From 6d3702a89315142c032a2da8ccd96488095e13a2 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 17 Apr 2019 10:47:16 +0200 Subject: [PATCH 1/2] PrefetchCache: Purge any object cache on forget or initialize --- library/Director/Db/Cache/PrefetchCache.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/Director/Db/Cache/PrefetchCache.php b/library/Director/Db/Cache/PrefetchCache.php index 905441dd..aa9f9508 100644 --- a/library/Director/Db/Cache/PrefetchCache.php +++ b/library/Director/Db/Cache/PrefetchCache.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Director\Db\Cache; use Icinga\Module\Director\CustomVariable\CustomVariable; +use Icinga\Module\Director\Data\Db\DbObject; use Icinga\Module\Director\Db; use Icinga\Module\Director\Objects\IcingaObject; use Icinga\Module\Director\Resolver\HostServiceBlacklist; @@ -36,6 +37,7 @@ class PrefetchCache public static function initialize(Db $db) { + self::forget(); self::$instance = new static($db); } @@ -60,6 +62,7 @@ class PrefetchCache public static function forget() { + DbObject::clearAllPrefetchCaches(); self::$instance = null; } From a30a28a7a1392bb33aba19dbb5ae93241813b7bf Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 17 Apr 2019 10:47:43 +0200 Subject: [PATCH 2/2] Sync: Purge TemplateRepository cache before sync --- library/Director/Import/Sync.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/Director/Import/Sync.php b/library/Director/Import/Sync.php index a3d9d386..cc890e8c 100644 --- a/library/Director/Import/Sync.php +++ b/library/Director/Import/Sync.php @@ -19,6 +19,7 @@ use Icinga\Module\Director\Objects\SyncProperty; use Icinga\Module\Director\Objects\SyncRule; use Icinga\Module\Director\Objects\SyncRun; use Icinga\Exception\IcingaException; +use Icinga\Module\Director\Repository\IcingaTemplateRepository; use InvalidArgumentException; class Sync @@ -811,6 +812,8 @@ class Sync protected function prepareCache() { PrefetchCache::initialize($this->db); + IcingaTemplateRepository::clear(); + $ruleObjectType = $this->rule->get('object_type'); $dummy = IcingaObject::createByType($ruleObjectType);