JedisSession
@Deprecated public class JedisSession implements Session
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:57–353Jedis 会话,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.core.session.redis.jedis 包,实现 Session。核心成员包括 builder、save、get、getList、exists、delete。
Redis-based session implementation using Jedis.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | `JedisSession`的构建器。 Builder for `JedisSession`. |
方法摘要Method Summary
方法详情Method Detail
builder
public static Builder builder()
static
创建新的构建器用于JedisSession。
Creates a new builder for JedisSession.
Builder一种新的构建器实例。a new Builder instance
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:84–86save
public void save(SessionKey sessionKey, String key, State value)
保存数据到持久化存储。
Performs the save operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | SessionKey | 会话键(类型 `SessionKey`)。The session key. |
key | String | 键(类型 `String`)。The key. |
value | State | 值(类型 `State`)。The value. |
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:88–102save
public void save(SessionKey sessionKey, String key, List<? extends State> values)
保存数据到持久化存储。
Save a list of state values with hash-based change detection.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | SessionKey | 会话键(类型 `SessionKey`)。the session identifier |
key | String | 键(类型 `String`)。the state key (e.g., "memory_messages") |
values | List<? extends State> | 状态值到保存的列出。the list of state values to save |
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:120–166get
public T extends State Optional<T> get(SessionKey sessionKey, String key, Class<T> type)
按条件读取数据。
Performs the get operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | SessionKey | 会话键(类型 `SessionKey`)。The session key. |
key | String | 键(类型 `String`)。The key. |
type | Class<T> | 类型(类型 `Class`)。The type. |
Optional<T>返回可选。Returns optional.
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:168–182getList
public T extends State List<T> getList(SessionKey sessionKey, String key, Class<T> itemType)
获取列表。
Returns the list.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | SessionKey | 会话键(类型 `SessionKey`)。The session key. |
key | String | 键(类型 `String`)。The key. |
itemType | Class<T> | 条目类型(类型 `Class`)。The item type. |
List<T>返回列出。Returns list.
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:184–204exists
public boolean exists(SessionKey sessionKey)
判断数据是否存在。
Performs the exists operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | SessionKey | 会话键(类型 `SessionKey`)。The session key. |
boolean返回布尔值,表示判断结果。Returns a boolean result.
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:206–217delete
public void delete(SessionKey sessionKey)
删除数据。
Performs the delete operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | SessionKey | 会话键(类型 `SessionKey`)。The session key. |
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:219–250listSessionKeys
public Set<SessionKey> listSessionKeys()
列出会话密钥。
Lists the session keys.
Set<SessionKey>返回设置。Returns set.
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:252–271close
public void close()
关闭连接并释放相关资源。
Releases resources and connections.
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:273–276clearAllSessions
public Mono<Integer> clearAllSessions()
清空所有会话。
Clear all sessions stored in Redis (for testing or cleanup).
Mono<Integer>返回Mono。Mono that completes with the number of deleted session keys
源码Source
io/agentscope/core/session/redis/jedis/JedisSession.java:283–297嵌套类详情Nested Class Detail
Builder
public static class BuilderJedisSession的构建器。位于 io.agentscope.core.session.redis.jedis 包。核心成员包括 keyPrefix、jedisPool、build。
Builder for JedisSession.