wuchong commented on a change in pull request #8341: [FLINK-11633][docs-zh]
Translate "Working with state" into Chinese
URL: https://github.com/apache/flink/pull/8341#discussion_r281009196
##########
File path: docs/dev/stream/state/state.zh.md
##########
@@ -260,23 +225,16 @@ object ExampleCountWindowAverage extends App {
</div>
</div>
-This example implements a poor man's counting window. We key the tuples by the
first field
-(in the example all have the same key `1`). The function stores the count and
a running sum in
-a `ValueState`. Once the count reaches 2 it will emit the average and clear
the state so that
-we start over from `0`. Note that this would keep a different state value for
each different input
-key if we had tuples with different values in the first field.
+这个例子实现了一个简单的计数窗口。 我们把元组的第一个元素当作键(在示例中都键都是 "1")。 该函数将出现的次数以及总和存储在 "ValueState"
中。
+一旦出现次数达到 2,则将平均值发送到下游,并清除状态重新开始。 请注意,我们会为每个不同的键(元组中第一个元素)保存一个单独的值。
-### State Time-To-Live (TTL)
+### 状态有效期 (TTL)
-A *time-to-live* (TTL) can be assigned to the keyed state of any type. If a
TTL is configured and a
-state value has expired, the stored value will be cleaned up on a best effort
basis which is
-discussed in more detail below.
+任何类型的 keyed state 都可以有 *有效期* (TTL)。如果配置了 TTL 且状态值已过期,则会里最大可能清除对应的值,这会在后面详述。
-All state collection types support per-entry TTLs. This means that list
elements and map entries
-expire independently.
+所有状态类型都支持单元素的 TTL。 这意味着列表元素和映射元素将独立到期。
-In order to use state TTL one must first build a `StateTtlConfig`
configuration object. The TTL
-functionality can then be enabled in any state descriptor by passing the
configuration:
+在使用状态 TTL 前,需要先构建一个`StateTtlConfig` 配置对象。 然后把配置传递到状态描述符中启用 TTL 功能:
Review comment:
```suggestion
在使用状态 TTL 前,需要先构建一个`StateTtlConfig` 配置对象。 然后把配置传递到 state descriptor 中启用 TTL
功能:
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services