Interface LookupCache
- All Superinterfaces:
AutoCloseable,Serializable
- All Known Implementing Classes:
DefaultLookupCache
A semi-persistent mapping from keys to values for storing entries of lookup table.
The type of the caching key is a RowData with lookup key fields packed inside. The
type of value is a Collection of RowData, 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
Modifier and TypeMethodDescriptiongetIfPresent(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.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 Details
-
open
void open(org.apache.flink.metrics.groups.CacheMetricGroup metricGroup) Initialize the cache.- Parameters:
metricGroup- the metric group to register cache related metrics.
-
getIfPresent
Returns the value associated with key in this cache, or null if there is no cached value for key. -
put
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
Discards any cached value for the specified key. -
size
long size()Returns the number of key-value mappings in the cache.
-