Package com.netflix.eureka.registry
Class ResponseCacheImpl
- java.lang.Object
-
- com.netflix.eureka.registry.ResponseCacheImpl
-
- All Implemented Interfaces:
ResponseCache
public class ResponseCacheImpl extends java.lang.Object implements ResponseCache
The class that is responsible for caching registry information that will be queried by the clients.The cache is maintained in compressed and non-compressed form for three categories of requests - all applications, delta changes and for individual applications. The compressed form is probably the most efficient in terms of network traffic especially when querying all applications. The cache also maintains separate pay load for JSON and XML formats and for multiple versions too.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classResponseCacheImpl.ValueThe class that stores payload in both compressed and uncompressed form.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALL_APPSstatic java.lang.StringALL_APPS_DELTA
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Stringget(Key key)Get the cached information about applications.intgetCurrentSize()Get the number of items in the response cache.byte[]getGZIP(Key key)Get the compressed information about the applications.java.util.concurrent.atomic.AtomicLonggetVersionDelta()Gets the version number of the cached data.static java.util.concurrent.atomic.AtomicLonggetVersionDeltaStatic()Deprecated.use instance methodgetVersionDelta()Gets the version number of the cached data.java.util.concurrent.atomic.AtomicLonggetVersionDeltaWithRegions()Gets the version number of the cached data with remote regions.static java.util.concurrent.atomic.AtomicLonggetVersionDeltaWithRegionsLegacy()Deprecated.use instance methodgetVersionDeltaWithRegions()Gets the version number of the cached data with remote regions.voidinvalidate(Key... keys)Invalidate the cache information given the list of keys.voidinvalidate(java.lang.String appName, java.lang.String vipAddress, java.lang.String secureVipAddress)Invalidate the cache of a particular application.voidstop()Performs a shutdown of this cache by stopping internal threads and unregistering Servo monitors.
-
-
-
Field Detail
-
ALL_APPS
public static final java.lang.String ALL_APPS
- See Also:
- Constant Field Values
-
ALL_APPS_DELTA
public static final java.lang.String ALL_APPS_DELTA
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public java.lang.String get(Key key)
Get the cached information about applications.If the cached information is not available it is generated on the first request. After the first request, the information is then updated periodically by a background thread.
- Specified by:
getin interfaceResponseCache- Parameters:
key- the key for which the cached information needs to be obtained.- Returns:
- payload which contains information about the applications.
-
getGZIP
public byte[] getGZIP(Key key)
Get the compressed information about the applications.- Specified by:
getGZIPin interfaceResponseCache- Parameters:
key- the key for which the compressed cached information needs to be obtained.- Returns:
- compressed payload which contains information about the applications.
-
stop
public void stop()
Description copied from interface:ResponseCachePerforms a shutdown of this cache by stopping internal threads and unregistering Servo monitors.- Specified by:
stopin interfaceResponseCache
-
invalidate
public void invalidate(java.lang.String appName, @Nullable java.lang.String vipAddress, @Nullable java.lang.String secureVipAddress)Invalidate the cache of a particular application.- Specified by:
invalidatein interfaceResponseCache- Parameters:
appName- the application name of the application.
-
invalidate
public void invalidate(Key... keys)
Invalidate the cache information given the list of keys.- Parameters:
keys- the list of keys for which the cache information needs to be invalidated.
-
getVersionDelta
public java.util.concurrent.atomic.AtomicLong getVersionDelta()
Gets the version number of the cached data.- Specified by:
getVersionDeltain interfaceResponseCache- Returns:
- teh version number of the cached data.
-
getVersionDeltaWithRegions
public java.util.concurrent.atomic.AtomicLong getVersionDeltaWithRegions()
Gets the version number of the cached data with remote regions.- Specified by:
getVersionDeltaWithRegionsin interfaceResponseCache- Returns:
- teh version number of the cached data with remote regions.
-
getVersionDeltaStatic
@Deprecated public static java.util.concurrent.atomic.AtomicLong getVersionDeltaStatic()
Deprecated.use instance methodgetVersionDelta()Gets the version number of the cached data.- Returns:
- teh version number of the cached data.
-
getVersionDeltaWithRegionsLegacy
@Deprecated public static java.util.concurrent.atomic.AtomicLong getVersionDeltaWithRegionsLegacy()
Deprecated.use instance methodgetVersionDeltaWithRegions()Gets the version number of the cached data with remote regions.- Returns:
- teh version number of the cached data with remote regions.
-
getCurrentSize
@Monitor(name="responseCacheSize", type=GAUGE) public int getCurrentSize()Get the number of items in the response cache.- Returns:
- int value representing the number of items in response cache.
-
-