JedisAgentStateStore
@Deprecated public class JedisAgentStateStore implements AgentStateStore
io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:57–415Jedis 智能体状态存储,负责持久化与读取数据。位于 io.agentscope.extensions.redis.state.jedis 包,实现 AgentStateStore。核心成员包括 builder、supportsVersioning、save、getVersioned、saveIfVersion、get。
Redis-based session implementation using Jedis.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | `JedisAgentStateStore`的构建器。 Builder for `JedisAgentStateStore`. |
方法摘要Method Summary
方法详情Method Detail
builder
public static Builder builder()
创建新的构建器用于JedisAgentStateStore。
Creates a new builder for JedisAgentStateStore.
Builderio/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:84–86supportsVersioning
public boolean supportsVersioning()
返回 supportsVersioning 结果。
Returns the supports versioning.
booleanio/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:88–91save
public void save(String userId, String sessionId, String key, State value)
保存数据到持久化存储。
Performs the save operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
key | String | 键(类型 `String`)。The key. |
value | State | 值(类型 `State`)。The value. |
io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:93–96getVersioned
public T extends State VersionedState<T> getVersioned(String userId, String sessionId, String key, Class<T> type)
获取 getVersioned。
Returns the versioned.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
key | String | 键(类型 `String`)。The key. |
type | Class<T> | 类型(类型 `Class`)。The type. |
VersionedState<T>io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:98–115saveIfVersion
public long saveIfVersion(String userId, String sessionId, String key, State value, long expectedVersion)
保存If 版本。
Saves the if version.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
key | String | 键(类型 `String`)。The key. |
value | State | 值(类型 `State`)。The value. |
expectedVersion | long | expected 版本(类型 `long`)。The expected version. |
longio/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:117–127save
public void save(String userId, String sessionId, String key, List<? extends State> values)
保存数据到持久化存储。
Save a list of state values with hash-based change detection.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。the user identifier |
sessionId | String | 会话标识(类型 `String`)。the session identifier |
key | String | 键(类型 `String`)。the state key (e.g., "memory_messages") |
values | List<? extends State> | 状态值到保存的列出。the list of state values to save |
io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:170–216get
public T extends State Optional<T> get(String userId, String sessionId, String key, Class<T> type)
按条件读取数据。
Performs the get operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
key | String | 键(类型 `String`)。The key. |
type | Class<T> | 类型(类型 `Class`)。The type. |
Optional<T>io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:218–233getList
public T extends State List<T> getList(String userId, String sessionId, String key, Class<T> itemType)
获取列表。
Returns the list.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
key | String | 键(类型 `String`)。The key. |
itemType | Class<T> | 条目类型(类型 `Class`)。The item type. |
List<T>io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:235–256exists
public boolean exists(String userId, String sessionId)
判断数据是否存在。
Performs the exists operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
booleanio/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:258–268delete
public void delete(String userId, String sessionId)
删除数据。
Performs the delete operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:270–300listSessionIds
public Set<String> listSessionIds(String userId)
列出 listSessionIds。
Lists the session ids.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
Set<String>io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:302–320close
public void close()
关闭连接并释放相关资源。
Releases resources and connections.
io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:335–338clearAllSessions
public Mono<Integer> clearAllSessions()
清空所有会话。
Clear all sessions stored in Redis (for testing or cleanup).
Mono<Integer>io/agentscope/extensions/redis/state/jedis/JedisAgentStateStore.java:345–359嵌套类详情Nested Class Detail
Builder
public static class BuilderJedisAgentStateStore的构建器。位于 io.agentscope.extensions.redis.state.jedis 包。核心成员包括 keyPrefix、jedisPool、build。
Builder for JedisAgentStateStore.