Package io.grpc.rls
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 long
private final long
private final RlsProtoData.RouteLookupResponse
private final long
Fields inherited from class io.grpc.rls.CachingRlsLbClient.CacheEntry
request
-
Constructor Summary
ConstructorsConstructorDescriptionDataCacheEntry
(RlsProtoData.RouteLookupRequest request, RlsProtoData.RouteLookupResponse response) -
Method Summary
Modifier and TypeMethodDescription(package private) int
calcStringSize
(String target) (package private) void
cleanup()
(package private) LbPolicyConfiguration.ChildPolicyWrapper
(package private) LbPolicyConfiguration.ChildPolicyWrapper
getChildPolicyWrapper
(String target) (package private) String
(package private) int
(package private) boolean
isExpired
(long now) protected boolean
isOldEnoughToBeEvicted
(long now) (package private) boolean
isStaled
(long now) (package private) void
Refreshes 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 thePendingCacheEntry
received 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:
getSizeBytes
in classCachingRlsLbClient.CacheEntry
-
isExpired
boolean isExpired(long now) - Specified by:
isExpired
in classCachingRlsLbClient.CacheEntry
-
isStaled
boolean isStaled(long now) -
isOldEnoughToBeEvicted
protected boolean isOldEnoughToBeEvicted(long now) - Overrides:
isOldEnoughToBeEvicted
in classCachingRlsLbClient.CacheEntry
-
cleanup
void cleanup()- Specified by:
cleanup
in classCachingRlsLbClient.CacheEntry
-
toString
-