Allow to skip retrieving from cache in the DiscoveryService
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
b2a87f84c4
commit
a0028a2a5f
|
@ -59,10 +59,12 @@ class DiscoveryService implements IDiscoveryService {
|
||||||
*
|
*
|
||||||
* @param string $remote
|
* @param string $remote
|
||||||
* @param string $service the service you want to discover
|
* @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
|
* @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
|
// Check the cache first
|
||||||
|
if ($skipCache === false) {
|
||||||
$cacheData = $this->cache->get($remote . '#' . $service);
|
$cacheData = $this->cache->get($remote . '#' . $service);
|
||||||
if ($cacheData) {
|
if ($cacheData) {
|
||||||
$data = json_decode($cacheData, true);
|
$data = json_decode($cacheData, true);
|
||||||
|
@ -70,6 +72,7 @@ class DiscoveryService implements IDiscoveryService {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$discoveredServices = [];
|
$discoveredServices = [];
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,9 @@ interface IDiscoveryService {
|
||||||
*
|
*
|
||||||
* @param string $remote
|
* @param string $remote
|
||||||
* @param string $service the service you want to discover
|
* @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
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function discover(string $remote, string $service): array;
|
public function discover(string $remote, string $service, bool $skipCache = false): array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue