diff --git a/src/WorkspaceHelper.php b/src/WorkspaceHelper.php index 2f874119..6edbf5cb 100644 --- a/src/WorkspaceHelper.php +++ b/src/WorkspaceHelper.php @@ -170,6 +170,7 @@ public static function saveWorkspaces(Configuration $config, $workspaces) } } } + Cache::clearTags(self::getCacheTags($config)); } /** @@ -210,6 +211,8 @@ public static function deleteConfiguration(Configuration $config) $db->delete(Dao::TABLE_NAME_DOCUMENT, ['configuration' => $config->getName()]); $db->delete(Dao::TABLE_NAME_ASSET, ['configuration' => $config->getName()]); $db->delete(Dao::TABLE_NAME_DATAOBJECT, ['configuration' => $config->getName()]); + + Cache::clearTags(self::getCacheTags($config)); } /** @@ -302,7 +305,7 @@ public static function isAllowed($element, Configuration $configuration, string private static function fetchLookupTable(string $elementType, Configuration $configuration): array { - $cacheKey = 'datahub_permissions_' . $configuration->getName() . '_' . $elementType; + $cacheKey = 'datahub_workspace_permissions_' . $configuration->getName() . '_' . $elementType; if (RuntimeCache::isRegistered($cacheKey)) { return RuntimeCache::load($cacheKey); } @@ -324,8 +327,13 @@ private static function fetchLookupTable(string $elementType, Configuration $con } RuntimeCache::save($lookupTable, $cacheKey); - Cache::save($lookupTable, $cacheKey); + Cache::save($lookupTable, $cacheKey, self::getCacheTags($configuration)); return $lookupTable; } + + private static function getCacheTags(Configuration $configuration): array + { + return ['datahub_workspace_permissions_'. $configuration->getName()]; + } }