Class CachingRlsLbClient.DataCacheEntry
java.lang.Object
io.grpc.rls.CachingRlsLbClient.CacheEntry
io.grpc.rls.CachingRlsLbClient.DataCacheEntry
- Enclosing class:
CachingRlsLbClient
Implementation of
CachingRlsLbClient.CacheEntry contains valid data.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<LbPolicyConfiguration.ChildPolicyWrapper> private final longprivate final longprivate final RlsProtoData.RouteLookupResponseprivate final longFields inherited from class CachingRlsLbClient.CacheEntry
request -
Constructor Summary
ConstructorsConstructorDescriptionDataCacheEntry(RlsProtoData.RouteLookupRequest request, RlsProtoData.RouteLookupResponse response) -
Method Summary
Modifier and TypeMethodDescription(package private) intcalcStringSize(String target) (package private) voidcleanup()(package private) LbPolicyConfiguration.ChildPolicyWrapper(package private) LbPolicyConfiguration.ChildPolicyWrappergetChildPolicyWrapper(String target) (package private) String(package private) int(package private) booleanisExpired(long now) protected booleanisOldEnoughToBeEvicted(long now) (package private) booleanisStaled(long now) (package private) voidRefreshes cache entry by creatingCachingRlsLbClient.PendingCacheEntry.toString()
-
Field Details
-
response
-
minEvictionTime
private final long minEvictionTime -
expireTime
private final long expireTime -
staleTime
private final long staleTime -
childPolicyWrappers
-
-
Constructor Details
-
DataCacheEntry
DataCacheEntry(RlsProtoData.RouteLookupRequest request, RlsProtoData.RouteLookupResponse response)
-
-
Method Details
-
maybeRefresh
void maybeRefresh()Refreshes cache entry by creatingCachingRlsLbClient.PendingCacheEntry. When thePendingCacheEntryreceived data from RLS server, it will replace the data entry if valid data still exists. Flow looks like following.Timeline | async refresh V put new cache (entry2) entry1: Pending | hasValue | staled | entry2: | OV* | pending | hasValue | staled | OV: old value -
getChildPolicyWrapper
-
getChildPolicyWrapper
-
getHeaderData
String getHeaderData() -
calcStringSize
-
getSizeBytes
int getSizeBytes()- Specified by:
getSizeBytesin classCachingRlsLbClient.CacheEntry
-
isExpired
boolean isExpired(long now) - Specified by:
isExpiredin classCachingRlsLbClient.CacheEntry
-
isStaled
boolean isStaled(long now) -
isOldEnoughToBeEvicted
protected boolean isOldEnoughToBeEvicted(long now) - Overrides:
isOldEnoughToBeEvictedin classCachingRlsLbClient.CacheEntry
-
cleanup
void cleanup()- Specified by:
cleanupin classCachingRlsLbClient.CacheEntry
-
toString
-