RedissonSession
@Deprecated public class RedissonSession implements Session
源码Source
io/agentscope/core/session/redis/redisson/RedissonSession.java:60–338Redisson 会话,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.core.session.redis.redisson 包,实现 Session。核心成员包括 builder、save、get、getList、exists、delete。
Redis-based session implementation using Redisson.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | `RedissonSession`的构建器。 Builder for `RedissonSession`. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static Builder builder()static | 创建新的构建器用于`RedissonSession`。 Creates a new builder for `RedissonSession`. |
public void save(SessionKey sessionKey, String key, State value) | 保存数据到持久化存储。 Performs the save operation. |
public void save(SessionKey sessionKey, String key, List<? extends State> values) | 保存数据到持久化存储。 Performs the save operation. |
public T extends State Optional<T> get(SessionKey sessionKey, String key, Class<T> type) | 按条件读取数据。 Performs the get operation. |
public T extends State List<T> getList(SessionKey sessionKey, String key, Class<T> itemType) | 获取列表。 Returns the list. |
public boolean exists(SessionKey sessionKey) | 判断数据是否存在。 Performs the exists operation. |
public void delete(SessionKey sessionKey) | 删除数据。 Performs the delete operation. |
public Set<SessionKey> listSessionKeys() | 列出会话密钥。 Lists the session keys. |
public void close() | 关闭连接并释放相关资源。 Releases resources and connections. |
public Mono<Integer> clearAllSessions() | 清空所有会话。 Clear all sessions stored in Redis (for testing or cleanup). |
方法详情Method Detail
builder
public static Builder builder()
static
创建新的构建器用于RedissonSession。
Creates a new builder for RedissonSession.
Builder一种新的构建器实例。a new Builder instance
源码Source
io/agentscope/core/session/redis/redisson/RedissonSession.java:86–88save
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/redisson/RedissonSession.java:90–108save
public void save(SessionKey sessionKey, String key, List<? extends State> values)
保存数据到持久化存储。
Performs the save operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | SessionKey | 会话键(类型 `SessionKey`)。The session key. |
key | String | 键(类型 `String`)。The key. |
values | List<? extends State> | 值(类型 `List`)。The values. |
源码Source
io/agentscope/core/session/redis/redisson/RedissonSession.java:110–138get
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/redisson/RedissonSession.java:140–156getList
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/redisson/RedissonSession.java:158–179exists
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/redisson/RedissonSession.java:181–192delete
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/redisson/RedissonSession.java:194–226listSessionKeys
public Set<SessionKey> listSessionKeys()
列出会话密钥。
Lists the session keys.
Set<SessionKey>返回设置。Returns set.
源码Source
io/agentscope/core/session/redis/redisson/RedissonSession.java:228–247close
public void close()
关闭连接并释放相关资源。
Releases resources and connections.
源码Source
io/agentscope/core/session/redis/redisson/RedissonSession.java:249–252clearAllSessions
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/redisson/RedissonSession.java:259–282嵌套类详情Nested Class Detail
Builder
public static class BuilderRedissonSession的构建器。位于 io.agentscope.core.session.redis.redisson 包。核心成员包括 keyPrefix、redissonClient、build。
Builder for RedissonSession.