IdempotencyStore
public final class IdempotencyStore implements InboundEventDeduplicator
io/agentscope/extensions/channel/common/IdempotencyStore.java:34–106Idempotency 存储,负责持久化与读取数据。位于 io.agentscope.extensions.channel.common 包,实现 InboundEventDeduplicator。核心成员包括 firstSeen、size、IdempotencyStore。
Bounded in-process implementation of InboundEventDeduplicator. Webhook providers
(notably WeCom) commonly retry the same message id under failure; this store de-duplicates by
msgId.
Internal map is bounded to #maxEntries — when full, entries are evicted to make
room: expired entries are dropped first, after which the victim is unspecified. Entries are
also lazily expired after #ttlMillis.
State lives in the JVM heap, so deduplication only holds within a single process; see InboundEventDeduplicator for multi-instance deployments. This class is thread-safe.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public IdempotencyStore() | 初始化 `IdempotencyStore` 实例。 Default 5-minute TTL, 10k entries — sufficient for any single channel's retry burst. |
public IdempotencyStore(long ttlMillis, int maxEntries) | 初始化 `IdempotencyStore` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public boolean firstSeen(String key) | 设置该参数。 Records `key` as seen. |
public int size() | 返回大小。 Returns the current size; mostly for tests/observability. |
构造器详情Constructor Detail
IdempotencyStore
public IdempotencyStore()
初始化 IdempotencyStore 实例。
Default 5-minute TTL, 10k entries — sufficient for any single channel's retry burst.
io/agentscope/extensions/channel/common/IdempotencyStore.java:41–43IdempotencyStore
public IdempotencyStore(long ttlMillis, int maxEntries)
初始化 IdempotencyStore 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ttlMillis | long | 存活时间毫秒(类型 `long`)。The ttl millis. |
maxEntries | int | 最大条目(类型 `int`)。The max entries. |
io/agentscope/extensions/channel/common/IdempotencyStore.java:45–54方法详情Method Detail
firstSeen
public boolean firstSeen(String key)
设置该参数。
Records key as seen.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key. |
booleanio/agentscope/extensions/channel/common/IdempotencyStore.java:62–78size
public int size()
返回大小。
Returns the current size; mostly for tests/observability.
intio/agentscope/extensions/channel/common/IdempotencyStore.java:103–105