diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-04-06 12:24:41 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-04-18 19:18:34 +0200 |
commit | a0028a2a5f7f4df3f38eef2ba1a4552ff90f0269 (patch) | |
tree | 42966d21d015453122d0184e8d106290ce85213f /lib/private/OCS | |
parent | b2a87f84c42ce1f7f6ad427a86a47921d68c582f (diff) | |
download | nextcloud-server-a0028a2a5f7f4df3f38eef2ba1a4552ff90f0269.tar.gz nextcloud-server-a0028a2a5f7f4df3f38eef2ba1a4552ff90f0269.zip |
Allow to skip retrieving from cache in the DiscoveryService
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/OCS')
-rw-r--r-- | lib/private/OCS/DiscoveryService.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/private/OCS/DiscoveryService.php b/lib/private/OCS/DiscoveryService.php index 016331e908f..6662263fb76 100644 --- a/lib/private/OCS/DiscoveryService.php +++ b/lib/private/OCS/DiscoveryService.php @@ -59,15 +59,18 @@ class DiscoveryService implements IDiscoveryService { * * @param string $remote * @param string $service the service you want to discover + * @param bool $skipCache We won't check if the data is in the cache. This is usefull if a background job is updating the status * @return array */ - public function discover(string $remote, string $service): array { + public function discover(string $remote, string $service, bool $skipCache = false): array { // Check the cache first - $cacheData = $this->cache->get($remote . '#' . $service); - if($cacheData) { - $data = json_decode($cacheData, true); - if (\is_array($data)) { - return $data; + if ($skipCache === false) { + $cacheData = $this->cache->get($remote . '#' . $service); + if ($cacheData) { + $data = json_decode($cacheData, true); + if (\is_array($data)) { + return $data; + } } } |