Interface LookupCache
-
- All Superinterfaces:
AutoCloseable,Serializable
- All Known Implementing Classes:
DefaultLookupCache
@PublicEvolving public interface LookupCache extends AutoCloseable, Serializable
A semi-persistent mapping from keys to values for storing entries of lookup table.The type of the caching key is a
RowDatawith lookup key fields packed inside. The type of value is aCollectionofRowData, which are rows matching lookup key fields.Cache entries are manually added using
put(org.apache.flink.table.data.RowData, java.util.Collection<org.apache.flink.table.data.RowData>), and are stored in the cache until either evicted or manually invalidated.Implementations of this interface are expected to be thread-safe, and can be safely accessed by multiple concurrent threads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<RowData>getIfPresent(RowData key)Returns the value associated with key in this cache, or null if there is no cached value for key.voidinvalidate(RowData key)Discards any cached value for the specified key.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.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
open
void open(org.apache.flink.metrics.groups.CacheMetricGroup metricGroup)
Initialize the cache.- Parameters:
metricGroup- the metric group to register cache related metrics.
-
getIfPresent
@Nullable Collection<RowData> getIfPresent(RowData key)
Returns the value associated with key in this cache, or null if there is no cached value for key.
-
put
Collection<RowData> put(RowData key, Collection<RowData> value)
Associates 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.- 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
void invalidate(RowData key)
Discards any cached value for the specified key.
-
size
long size()
Returns the number of key-value mappings in the cache.
-
-