Class CachedDataStream<T>

  • Type Parameters:
    T - The type of the elements in this stream.

    @PublicEvolving
    public class CachedDataStream<T>
    extends DataStream<T>
    CachedDataStream represents a DataStream whose intermediate result will be cached at the first time when it is computed. And the cached intermediate result can be used in later job that using the same CachedDataStream to avoid re-computing the intermediate result.
    • Constructor Detail

      • CachedDataStream

        public CachedDataStream​(StreamExecutionEnvironment environment,
                                org.apache.flink.api.dag.Transformation<T> transformation)
        Create a new CachedDataStream in the given execution environment that wrap the given physical transformation to indicates that the transformation should be cached.
        Parameters:
        environment - The StreamExecutionEnvironment
        transformation - The physical transformation whose intermediate result should be cached.
    • Method Detail

      • invalidate

        public void invalidate()
                        throws Exception
        Invalidate the cache intermediate result of this DataStream to release the physical resources. Users are not required to invoke this method to release physical resources unless they want to. Cache will be recreated if it is used after invalidated.
        Throws:
        Exception