RedisStateVersionSupport
public final class RedisStateVersionSupport
io/agentscope/extensions/redis/state/RedisStateVersionSupport.java:24–104Redis 状态版本 Support,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.extensions.redis.state 包。核心成员包括 versionKey、parseVersion、saveScriptKeys、saveScriptArgs、unconditionalSaveArgs、VERSION_SUFFIX。
Shared optimistic-concurrency helpers for Redis-backed io.agentscope.core.state.AgentStateStore implementations.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
VERSION_SUFFIXstaticfinal | String | 版本 SUFFIX字段。 Redis key suffix for the monotonic version counter of a single state value. |
UNCONDITIONALstaticfinal | String | UNCONDITIONAL字段。 Lua `ARGV[2]` sentinel for unconditional overwrite inside `#SAVE_SCRIPT`. |
SAVE_SCRIPTstaticfinal | String | 保存 SCRIPT字段。 Atomically compare-and-set or unconditionally bump a versioned payload. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static String versionKey(String payloadKey)static | 设置版本键。 Performs the version key operation. |
public static long parseVersion(String payload, String versionValue)static | 解析版本。 Parses the version. |
public static List<String> saveScriptKeys(String payloadKey, String versionKey, String keysKey)static | 保存 `saveScriptKeys`。 Saves the script keys. |
public static List<String> saveScriptArgs(String payload, long expectedVersion, String keyMember)static | 保存 `saveScriptArgs`。 Saves the script args. |
public static List<String> unconditionalSaveArgs(String payload, String keyMember)static | 执行 `unconditionalSaveArgs` 方法。 Performs the unconditional save args operation. |
字段详情Field Detail
VERSION_SUFFIX
public static final String VERSION_SUFFIX
版本 SUFFIX字段。声明为 public static final String VERSION_SUFFIX。
Redis key suffix for the monotonic version counter of a single state value.
io/agentscope/extensions/redis/state/RedisStateVersionSupport.java:27UNCONDITIONAL
public static final String UNCONDITIONAL
UNCONDITIONAL字段。声明为 public static final String UNCONDITIONAL。
Lua ARGV[2] sentinel for unconditional overwrite inside #SAVE_SCRIPT.
io/agentscope/extensions/redis/state/RedisStateVersionSupport.java:30SAVE_SCRIPT
public static final String SAVE_SCRIPT
保存 SCRIPT字段。声明为 public static final String SAVE_SCRIPT。
Atomically compare-and-set or unconditionally bump a versioned payload.
io/agentscope/extensions/redis/state/RedisStateVersionSupport.java:39–73方法详情Method Detail
versionKey
public static String versionKey(String payloadKey)
设置版本键。
Performs the version key operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payloadKey | String | 负载键(类型 `String`)。The payload key. |
Stringio/agentscope/extensions/redis/state/RedisStateVersionSupport.java:77–79parseVersion
public static long parseVersion(String payload, String versionValue)
解析版本。
Parses the version.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payload | String | 负载(类型 `String`)。The payload. |
versionValue | String | 版本值(类型 `String`)。The version value. |
longio/agentscope/extensions/redis/state/RedisStateVersionSupport.java:81–89saveScriptKeys
public static List<String> saveScriptKeys(String payloadKey, String versionKey, String keysKey)
保存 saveScriptKeys。
Saves the script keys.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payloadKey | String | 负载键(类型 `String`)。The payload key. |
versionKey | String | 版本键(类型 `String`)。The version key. |
keysKey | String | 密钥键(类型 `String`)。The keys key. |
List<String>io/agentscope/extensions/redis/state/RedisStateVersionSupport.java:91–94saveScriptArgs
public static List<String> saveScriptArgs(String payload, long expectedVersion, String keyMember)
保存 saveScriptArgs。
Saves the script args.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payload | String | 负载(类型 `String`)。The payload. |
expectedVersion | long | expected 版本(类型 `long`)。The expected version. |
keyMember | String | 键成员(类型 `String`)。The key member. |
List<String>io/agentscope/extensions/redis/state/RedisStateVersionSupport.java:96–99unconditionalSaveArgs
public static List<String> unconditionalSaveArgs(String payload, String keyMember)
执行 unconditionalSaveArgs 方法。
Performs the unconditional save args operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payload | String | 负载(类型 `String`)。The payload. |
keyMember | String | 键成员(类型 `String`)。The key member. |
List<String>io/agentscope/extensions/redis/state/RedisStateVersionSupport.java:101–103