From 6a7d6aa068c8b3b85ce74037f5387ae025b12762 Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Thu, 27 Aug 2020 09:59:30 +0200 Subject: [PATCH] fix: field long time caching --- src/QUI/ERP/Products/Field/Field.php | 3 +++ src/QUI/ERP/Products/Handler/Fields.php | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/QUI/ERP/Products/Field/Field.php b/src/QUI/ERP/Products/Field/Field.php index 00e8151f..df358494 100644 --- a/src/QUI/ERP/Products/Field/Field.php +++ b/src/QUI/ERP/Products/Field/Field.php @@ -357,6 +357,9 @@ public function save() // clear field cache QUI\Cache\LongTermCache::clear('quiqqer/products/fields'); + QUI\Cache\LongTermCache::clear( + QUI\ERP\Products\Handler\Fields::getFieldCacheName($this->getId()) + ); QUI::getEvents()->fireEvent('onQuiqqerProductsFieldSave', [$this]); } diff --git a/src/QUI/ERP/Products/Handler/Fields.php b/src/QUI/ERP/Products/Handler/Fields.php index 15ed2388..0513a561 100644 --- a/src/QUI/ERP/Products/Handler/Fields.php +++ b/src/QUI/ERP/Products/Handler/Fields.php @@ -718,10 +718,10 @@ public static function getField($fieldId) self::$list = []; } + $cacheName = QUI\ERP\Products\Handler\Fields::getFieldCacheName($fieldId); + try { - $data = QUI\Cache\LongTermCache::get( - QUI\ERP\Products\Handler\Fields::getFieldCacheName($fieldId) - ); + $data = QUI\Cache\LongTermCache::get($cacheName); } catch (QUI\Exception $Exception) { try { $result = QUI::getDataBase()->fetch([ @@ -753,6 +753,8 @@ public static function getField($fieldId) } $data = $result[0]; + + QUI\Cache\LongTermCache::set($cacheName, $data); } -- GitLab