sjwiesman commented on a change in pull request #124:
URL: https://github.com/apache/flink-statefun/pull/124#discussion_r433267050



##########
File path: docs/sdk/java.md
##########
@@ -364,6 +364,47 @@ PersistedTable<String, Integer> table = 
PersistedTable.of("my-table", String.cla
 PersistedAppendingBuffer<Integer> buffer = 
PersistedAppendingBuffer.of("my-buffer", Integer.class);
 {% endhighlight %}
 
+### State Expiration
+
+Persisted states may be configured to expire and be deleted after a specified 
duration.
+This is supported by all types of state:
+
+{% highlight java %}
+@Persisted
+PersistedValue<Integer> table = PersistedValue.of(
+    "my-value",
+    Integer.class,
+    Expiration.expireAfterWriting(Duration.ofHours(1)));
+
+@Persisted
+PersistedTable<String, Integer> table = PersistedTable.of(
+    "my-table",
+    String.class,
+    Integer.class,
+    Expiration.expireAfterWriting(Duration.ofMinutes(5)));
+
+@Persisted
+PersistedAppendingBuffer<Integer> buffer = PersistedAppendingBuffer.of(
+    "my-buffer",
+    Integer.class,
+    Expiration.expireAfterWriting(Duration.ofSeconds(30)));
+{% endhighlight %}
+
+There are two expiration modes supported:
+
+{% highlight java %}
+Expiration.expireAfterWriting(...)
+
+Expiration.expireAfterReadingOrWriting(...)
+{% endhighlight %}
+
+The above modes differ in when expiration timers for the state will be 
registered, either only on writes or on both reads and writes.
+
+These timers will also be persisted as managed state. This allows the timers 
to still be effectively running while the application is down.

Review comment:
       Agreed, I put my suggestion on the other PR. 




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to