You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by crazy <24...@qq.com.INVALID> on 2023/04/07 09:30:58 UTC
operator state ttl
大佬们好,
flink版本1.13.5,目前想使用operator state,设置的TTL时间是否没法针对MapState里的key数据进行过期?有其他的方法实现key数据过期吗?谢谢
StateTtlConfig ttlConfig = StateTtlConfig
// 设置状态周期过期时间
.newBuilder(org.apache.flink.api.common.time.Time.minutes(1))
.setUpdateType(StateTtlConfig.UpdateType.OnCreateAndWrite)
.setStateVisibility(StateTtlConfig.StateVisibility.ReturnExpiredIfNotCleanedUp)
.cleanupInRocksdbCompactFilter(1000)
.build();
MapStateDescriptor<String, String> interactDescriptor = new MapStateDescriptor<>("interactState", String.class, String.class);
interactDescriptor.enableTimeToLive(ttlConfig);
interactState = context.getOperatorStateStore().getBroadcastState(interactDescriptor);
crazy
2463829830@qq.com