$session */ public static function resolveTenantScope(array $session): string { $tenantId = (int) (($session['current_tenant']['id'] ?? 0)); return $tenantId > 0 ? (string) $tenantId : 'global'; } public static function ticketsKey(string $tenantScope, string $customerNo): string { return 'module.helpdesk.debitor.v2.tickets.' . $tenantScope . '.' . trim($customerNo); } public static function contactsKey(string $tenantScope, string $customerNo): string { return 'module.helpdesk.debitor.v2.contacts.' . $tenantScope . '.' . trim($customerNo); } public static function communicationKey(string $tenantScope, string $customerNo): string { return 'module.helpdesk.debitor.v2.communication.' . $tenantScope . '.' . trim($customerNo); } public static function escalationKey(string $tenantScope, string $customerNo): string { return 'module.helpdesk.debitor.v2.escalation.' . $tenantScope . '.' . trim($customerNo); } public static function contractsKey(string $tenantScope, string $customerNo): string { return 'module.helpdesk.debitor.v2.contracts.' . $tenantScope . '.' . trim($customerNo); } public static function contractLinesKey(string $tenantScope, string $customerNo): string { return 'module.helpdesk.debitor.v2.contract-lines.' . $tenantScope . '.' . trim($customerNo); } public static function controllingTicketsKey(string $tenantScope, string $customerNo): string { return 'module.helpdesk.debitor.v2.controlling-tickets.' . $tenantScope . '.' . trim($customerNo); } public static function escalationDefinitionsKey(string $tenantScope): string { return 'module.helpdesk.debitor.v1.escalation-definitions.' . $tenantScope; } /** * @return array */ public static function allDebitorCacheKeys(string $tenantScope, string $customerNo): array { return [ self::ticketsKey($tenantScope, $customerNo), self::contactsKey($tenantScope, $customerNo), self::communicationKey($tenantScope, $customerNo), self::escalationKey($tenantScope, $customerNo), self::contractsKey($tenantScope, $customerNo), self::contractLinesKey($tenantScope, $customerNo), self::controllingTicketsKey($tenantScope, $customerNo), // Legacy keys kept for hard refresh compatibility 'module.helpdesk.tickets_cache.' . $tenantScope . '.' . trim($customerNo), 'module.helpdesk.contacts_cache.v1.' . $tenantScope . '.' . trim($customerNo), 'module.helpdesk.debitor_comm_cache.v3.' . $tenantScope . '.' . trim($customerNo), 'module.helpdesk.escalation_cache.v1.' . $tenantScope . '.' . trim($customerNo), 'module.helpdesk.contracts_cache.v2.' . $tenantScope . '.' . trim($customerNo), ]; } public static function invalidateDebitorCaches( SessionStoreInterface $sessionStore, string $tenantScope, string $customerNo, bool $includeTenantShared = true ): void { foreach (self::allDebitorCacheKeys($tenantScope, $customerNo) as $key) { $sessionStore->remove($key); } if ($includeTenantShared) { $sessionStore->remove(self::escalationDefinitionsKey($tenantScope)); } } }