Class CountEvictor<W extends Window>
- java.lang.Object
-
- org.apache.flink.streaming.api.windowing.evictors.CountEvictor<W>
-
- Type Parameters:
W- The type ofWindowson which thisEvictorcan operate.
- All Implemented Interfaces:
Serializable,Evictor<Object,W>
@PublicEvolving public class CountEvictor<W extends Window> extends Object implements Evictor<Object,W>
AnEvictorthat keeps up to a certain amount of elements.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.windowing.evictors.Evictor
Evictor.EvictorContext
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.static <W extends Window>
CountEvictor<W>of(long maxCount)Creates aCountEvictorthat keeps the given number of elements.static <W extends Window>
CountEvictor<W>of(long maxCount, boolean doEvictAfter)Creates aCountEvictorthat keeps the given number of elements in the pane Eviction is done before/after the window function based on the value of doEvictAfter.
-
-
-
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.
-
of
public static <W extends Window> CountEvictor<W> of(long maxCount)
Creates aCountEvictorthat keeps the given number of elements. Eviction is done before the window function.- Parameters:
maxCount- The number of elements to keep in the pane.
-
of
public static <W extends Window> CountEvictor<W> of(long maxCount, boolean doEvictAfter)
Creates aCountEvictorthat keeps the given number of elements in the pane Eviction is done before/after the window function based on the value of doEvictAfter.- Parameters:
maxCount- The number of elements to keep in the pane.doEvictAfter- Whether to do eviction after the window function.
-
-