Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3e70a01 authored by theronakpatel's avatar theronakpatel
Browse files

clicnetCache moved at construct

parent 088719a7
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ class SSOService {
	private IUserManager $userManager;
	private TwoFactorMapper $twoFactorMapper;
	private ICacheFactory $cacheFactory;
	private ICache $clientsCache;

	private string $mainDomain;
	private string $legacyDomain;
@@ -60,6 +61,7 @@ class SSOService {
		$this->userManager = $userManager;
		$this->twoFactorMapper = $twoFactorMapper;
		$this->cacheFactory = $cacheFactory;
		$this->clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_realm_clients');

		$this->mainDomain = $this->config->getSystemValue("main_domain");
		$this->legacyDomain = $this->config->getSystemValue("legacy_domain");
@@ -155,8 +157,7 @@ class SSOService {
		$cacheKey = "{$clientsUrl}|no_params|no_keys";
		
		// Try to get cached clients
		$clientsCache = $this->cacheFactory->createDistributed('ecloud_accounts_realm_clients');
		$cachedClients = $clientsCache->get($cacheKey);
		$cachedClients = $this->clientsCache->get($cacheKey);
		if ($cachedClients !== null) {
			$this->logger->debug('Returning cached clients from distributed cache');
			return $cachedClients;
@@ -170,7 +171,7 @@ class SSOService {
				return [];
			}

			$clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL);
			$this->clientsCache->set($cacheKey, $clients, self::CLIENTS_CACHE_TTL);
			
			return $clients;
		} catch (\Exception $e) {