public final class ServiceCache extends Object
Cache serviceIds and corresponding instances in Nacos.
It's very useful to query services and instances on runtime, but it's not real-time,
depends on NacosDiscoveryClient or NacosReactiveDiscoveryClient
getServices(), getInstances(..) invoke.
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
get()
Deprecated.
since 2021.0.1.1, use
getServiceIds() instead. |
static List<org.springframework.cloud.client.ServiceInstance> |
getInstances(String serviceId)
Get instances for specific service.
|
static List<String> |
getServiceIds()
Get all services.
|
static void |
set(List<String> serviceIds)
Deprecated.
since 2021.0.1.1, use
setServiceIds(List) instead. |
static void |
setInstances(String serviceId,
List<org.springframework.cloud.client.ServiceInstance> instances)
Set instances for specific service.
|
static void |
setServiceIds(List<String> serviceIds)
Set all services.
|
public static void setInstances(String serviceId, List<org.springframework.cloud.client.ServiceInstance> instances)
serviceId - service idinstances - service instancespublic static List<org.springframework.cloud.client.ServiceInstance> getInstances(String serviceId)
serviceId - service id@Deprecated public static void set(List<String> serviceIds)
setServiceIds(List) instead.serviceIds - all servicespublic static void setServiceIds(List<String> serviceIds)
serviceIds - all services@Deprecated public static List<String> get()
getServiceIds() instead.Copyright © 2023 Pivotal Software, Inc.. All rights reserved.