wenjin272 commented on code in PR #887:
URL: https://github.com/apache/flink-agents/pull/887#discussion_r3719200583
##########
docs/content/docs/development/memory/sensory_and_short_term_memory.md:
##########
@@ -291,9 +291,13 @@ Short-term memory can be configured with a time-to-live
(TTL) so that older stat
Set `short-term-memory.state-ttl.ms` to a value greater than 0 in milliseconds
to enable TTL. You can also configure how the TTL is refreshed and whether
expired state can be returned before Flink cleans it up:
-- `short-term-memory.state-ttl.update-type`: controls whether TTL is refreshed
on create/write or on read/write.
+- `short-term-memory.state-ttl.update-type`: controls whether TTL is refreshed
on create/write (`ON_CREATE_AND_WRITE`) or on read/write (`ON_READ_AND_WRITE`,
the default).
- `short-term-memory.state-ttl.visibility`: controls whether expired memory is
never returned or may be returned if it has not been cleaned up yet.
+{{< hint warning >}}
+The default `ON_READ_AND_WRITE` update type extends an entry's lifetime
whenever it is read. This also applies when producing the run-begin snapshot
used by [Memory Events]({{< ref "docs/development/memory/memory_events" >}}):
if you opt in through `agent-run.begin-event`, each input scans the key's
short-term memory and refreshes TTL for the entries it reads, although only
value nodes are included in the event. Choose `ON_CREATE_AND_WRITE` when
entries should expire based only on writes.
Review Comment:
The last sentence skips the direct option of leaving the run-begin event
disabled. Could we make the choices explicit?
> With the default update type `ON_READ_AND_WRITE`, every read refreshes an
entry's TTL. Enabling `agent-run.begin-event` introduces an additional source
of reads: each input scans the key's short-term memory to produce the run-begin
snapshot, which may extend the lifetime of the scanned entries even though only
value nodes are included in the event. Leave `agent-run.begin-event` disabled
if the snapshot is not needed. If the snapshot is needed but reads should not
extend TTL, use `ON_CREATE_AND_WRITE`.
The corresponding warning in `memory_events.md` should be aligned as well.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]