Package io.grpc.rls
Class CachingRlsLbClient.AutoCleaningEvictionListener
java.lang.Object
io.grpc.rls.CachingRlsLbClient.AutoCleaningEvictionListener
- All Implemented Interfaces:
LruCache.EvictionListener<RlsProtoData.RouteLookupRequest,
CachingRlsLbClient.CacheEntry>
- Enclosing class:
CachingRlsLbClient
private static final class CachingRlsLbClient.AutoCleaningEvictionListener
extends Object
implements LruCache.EvictionListener<RlsProtoData.RouteLookupRequest,CachingRlsLbClient.CacheEntry>
When any
CachingRlsLbClient.CacheEntry
is evicted from LruCache
, it performs CachingRlsLbClient.CacheEntry.cleanup()
after original LruCache.EvictionListener
is finished.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LruCache.EvictionListener
<RlsProtoData.RouteLookupRequest, CachingRlsLbClient.CacheEntry> -
Constructor Summary
ConstructorsConstructorDescriptionAutoCleaningEvictionListener
(LruCache.EvictionListener<RlsProtoData.RouteLookupRequest, CachingRlsLbClient.CacheEntry> delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
onEviction
(RlsProtoData.RouteLookupRequest key, CachingRlsLbClient.CacheEntry value, LruCache.EvictionType cause) Notifies the listener when any cache entry is evicted.
-
Field Details
-
delegate
private final LruCache.EvictionListener<RlsProtoData.RouteLookupRequest,CachingRlsLbClient.CacheEntry> delegate
-
-
Constructor Details
-
AutoCleaningEvictionListener
AutoCleaningEvictionListener(@Nullable LruCache.EvictionListener<RlsProtoData.RouteLookupRequest, CachingRlsLbClient.CacheEntry> delegate)
-
-
Method Details
-
onEviction
public void onEviction(RlsProtoData.RouteLookupRequest key, CachingRlsLbClient.CacheEntry value, LruCache.EvictionType cause) Description copied from interface:LruCache.EvictionListener
Notifies the listener when any cache entry is evicted. Implementation can assume that this method is called serially. Implementation should be non blocking, for long running task consider offloading the task toExecutor
.- Specified by:
onEviction
in interfaceLruCache.EvictionListener<RlsProtoData.RouteLookupRequest,
CachingRlsLbClient.CacheEntry>
-