Class DefaultLookupCache
- java.lang.Object
-
- org.apache.flink.table.connector.source.lookup.cache.DefaultLookupCache
-
- All Implemented Interfaces:
Serializable,AutoCloseable,LookupCache
@PublicEvolving public class DefaultLookupCache extends Object implements LookupCache
Default implementation ofLookupCache.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultLookupCache.BuilderBuilder forDefaultLookupCache.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanequals(Object o)static DefaultLookupCachefromConfig(org.apache.flink.configuration.ReadableConfig config)Collection<RowData>getIfPresent(RowData key)Returns the value associated with key in this cache, or null if there is no cached value for key.inthashCode()voidinvalidate(RowData key)Discards any cached value for the specified key.static DefaultLookupCache.BuildernewBuilder()Creates a builder for the cache.voidopen(org.apache.flink.metrics.groups.CacheMetricGroup metricGroup)Initialize the cache.Collection<RowData>put(RowData key, Collection<RowData> value)Associates the specified value rows with the specified key row in the cache.longsize()Returns the number of key-value mappings in the cache.
-
-
-
Method Detail
-
newBuilder
public static DefaultLookupCache.Builder newBuilder()
Creates a builder for the cache.
-
fromConfig
public static DefaultLookupCache fromConfig(org.apache.flink.configuration.ReadableConfig config)
-
open
public void open(org.apache.flink.metrics.groups.CacheMetricGroup metricGroup)
Description copied from interface:LookupCacheInitialize the cache.- Specified by:
openin interfaceLookupCache- Parameters:
metricGroup- the metric group to register cache related metrics.
-
getIfPresent
@Nullable public Collection<RowData> getIfPresent(RowData key)
Description copied from interface:LookupCacheReturns the value associated with key in this cache, or null if there is no cached value for key.- Specified by:
getIfPresentin interfaceLookupCache
-
put
public Collection<RowData> put(RowData key, Collection<RowData> value)
Description copied from interface:LookupCacheAssociates the specified value rows with the specified key row in the cache. If the cache previously contained value associated with the key, the old value is replaced by the specified value.- Specified by:
putin interfaceLookupCache- Parameters:
key- - key row with which the specified value is to be associatedvalue- – value rows to be associated with the specified key- Returns:
- the previous value rows associated with key, or null if there was no mapping for key.
-
invalidate
public void invalidate(RowData key)
Description copied from interface:LookupCacheDiscards any cached value for the specified key.- Specified by:
invalidatein interfaceLookupCache
-
size
public long size()
Description copied from interface:LookupCacheReturns the number of key-value mappings in the cache.- Specified by:
sizein interfaceLookupCache
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
-