Class TimeEvictor<W extends org.apache.flink.streaming.api.windowing.windows.Window>
- java.lang.Object
-
- org.apache.flink.streaming.api.windowing.evictors.TimeEvictor<W>
-
- Type Parameters:
W- The type ofWindowson which thisEvictorcan operate.
- All Implemented Interfaces:
Serializable,org.apache.flink.streaming.api.windowing.evictors.Evictor<Object,W>
@PublicEvolving public class TimeEvictor<W extends org.apache.flink.streaming.api.windowing.windows.Window> extends Object implements org.apache.flink.streaming.api.windowing.evictors.Evictor<Object,W>
AnEvictorthat keeps elements for a certain amount of time. Elements older thancurrent_time - keep_timeare evicted. The current_time is time associated withTimestampedValue- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TimeEvictor(long windowSize)TimeEvictor(long windowSize, boolean doEvictAfter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevictAfter(Iterable<org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue<Object>> elements, int size, W window, org.apache.flink.streaming.api.windowing.evictors.Evictor.EvictorContext ctx)voidevictBefore(Iterable<org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue<Object>> elements, int size, W window, org.apache.flink.streaming.api.windowing.evictors.Evictor.EvictorContext ctx)longgetWindowSize()static <W extends org.apache.flink.streaming.api.windowing.windows.Window>
TimeEvictor<W>of(Duration windowSize)Creates aTimeEvictorthat keeps the given number of elements.static <W extends org.apache.flink.streaming.api.windowing.windows.Window>
TimeEvictor<W>of(Duration windowSize, boolean doEvictAfter)Creates aTimeEvictorthat keeps the given number of elements.StringtoString()
-
-
-
Method Detail
-
evictBefore
public void evictBefore(Iterable<org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue<Object>> elements, int size, W window, org.apache.flink.streaming.api.windowing.evictors.Evictor.EvictorContext ctx)
-
evictAfter
public void evictAfter(Iterable<org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue<Object>> elements, int size, W window, org.apache.flink.streaming.api.windowing.evictors.Evictor.EvictorContext ctx)
-
getWindowSize
@VisibleForTesting public long getWindowSize()
-
of
public static <W extends org.apache.flink.streaming.api.windowing.windows.Window> TimeEvictor<W> of(Duration windowSize)
Creates aTimeEvictorthat keeps the given number of elements. Eviction is done before the window function.- Parameters:
windowSize- The amount of time for which to keep elements.
-
of
public static <W extends org.apache.flink.streaming.api.windowing.windows.Window> TimeEvictor<W> of(Duration windowSize, boolean doEvictAfter)
Creates aTimeEvictorthat keeps the given number of elements. Eviction is done before/after the window function based on the value of doEvictAfter.- Parameters:
windowSize- The amount of time for which to keep elements.doEvictAfter- Whether eviction is done after window function.
-
-