Spring Data Gemfire:如何使用注释为条目设置 TTL?

Spring Data Gemfire: How to set TTL for entry using annotation?

我正在尝试为某个区域的条目设置 30 天的超时(即 2592000 秒)。

在 gfsh 中,我能够做到 create region --name=employee --type=REPLICATE --enable-statistics --entry-time-to-live-expiration=2592000。为了确认,我们是否使用 @TimeToLiveExpiration 作为条目而不是区域。我不想删除该区域。如果这是为了入门那么好奇我们如何设置区域?谢谢

@ReplicatedRegion(name = "employee") 
@EnableStatistics 
@TimeToLiveExpiration(timeout = "2592000", action = "DESTROY") // is this for region or entry ?? 
@Data
public class Employee {
   private String id; 
}

是的,SDG 的实体级基于过期的注释,@TimeToLiveExpiration@IdleTimeoutExpiration 配置 Region“入门级”过期策略。

从技术上讲,这是 implemented as an CustomExpiry object (Javadoc) 在 Region 上注册的(例如“employees”)。这些注释绝对不会过期,或者 delete/remove Region.

可以找到有关使用 SDG 配置 Apache Geode (GemFire) 过期(策略)的更多信息 here and here