Class TimeEvictor<W extends 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,Evictor<Object,W>
@PublicEvolving public class TimeEvictor<W extends Window> extends Object implements 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.windowing.evictors.Evictor
Evictor.EvictorContext
-
-
Constructor Summary
Constructors Constructor Description TimeEvictor(long windowSize)TimeEvictor(long windowSize, boolean doEvictAfter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidevictAfter(Iterable<TimestampedValue<Object>> elements, int size, W window, Evictor.EvictorContext ctx)Optionally evicts elements.voidevictBefore(Iterable<TimestampedValue<Object>> elements, int size, W window, Evictor.EvictorContext ctx)Optionally evicts elements.longgetWindowSize()static <W extends Window>
TimeEvictor<W>of(java.time.Duration windowSize)Creates aTimeEvictorthat keeps the given number of elements.static <W extends Window>
TimeEvictor<W>of(java.time.Duration windowSize, boolean doEvictAfter)Creates aTimeEvictorthat keeps the given number of elements.static <W extends Window>
TimeEvictor<W>of(Time windowSize)Deprecated.Useof(Duration)static <W extends Window>
TimeEvictor<W>of(Time windowSize, boolean doEvictAfter)Deprecated.StringtoString()
-
-
-
Method Detail
-
evictBefore
public void evictBefore(Iterable<TimestampedValue<Object>> elements, int size, W window, Evictor.EvictorContext ctx)
Description copied from interface:EvictorOptionally evicts elements. Called before windowing function.
-
evictAfter
public void evictAfter(Iterable<TimestampedValue<Object>> elements, int size, W window, Evictor.EvictorContext ctx)
Description copied from interface:EvictorOptionally evicts elements. Called after windowing function.
-
getWindowSize
@VisibleForTesting public long getWindowSize()
-
of
@Deprecated public static <W extends Window> TimeEvictor<W> of(Time windowSize)
Deprecated.Useof(Duration)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 Window> TimeEvictor<W> of(java.time.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
@Deprecated public static <W extends Window> TimeEvictor<W> of(Time windowSize, boolean doEvictAfter)
Deprecated.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.
-
of
public static <W extends Window> TimeEvictor<W> of(java.time.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.
-
-