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>
An
Evictor that keeps elements for a certain amount of time. Elements older than
current_time - keep_time are evicted. The current_time is time associated with TimestampedValue- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.windowing.evictors.Evictor
org.apache.flink.streaming.api.windowing.evictors.Evictor.EvictorContext -
Constructor Summary
ConstructorsConstructorDescriptionTimeEvictor(long windowSize) TimeEvictor(long windowSize, boolean doEvictAfter) -
Method Summary
Modifier and TypeMethodDescriptionvoidevictAfter(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) longstatic <W extends org.apache.flink.streaming.api.windowing.windows.Window>
TimeEvictor<W>Creates aTimeEvictorthat keeps the given number of elements.static <W extends org.apache.flink.streaming.api.windowing.windows.Window>
TimeEvictor<W>Creates aTimeEvictorthat keeps the given number of elements.toString()
-
Constructor Details
-
TimeEvictor
public TimeEvictor(long windowSize) -
TimeEvictor
public TimeEvictor(long windowSize, boolean doEvictAfter)
-
-
Method Details
-
evictBefore
-
evictAfter
-
toString
-
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.
-