Class JedisAgentStateStore

java.lang.Object
io.agentscope.extensions.redis.state.jedis.JedisAgentStateStore
All Implemented Interfaces:
io.agentscope.core.state.AgentStateStore

@Deprecated public class JedisAgentStateStore extends Object implements io.agentscope.core.state.AgentStateStore
Deprecated.
Use RedisAgentStateStore with jedisClient instead. RedisAgentStateStore provides a unified session implementation that works with multiple Redis clients. For basic usage, simple constructors are available. For advanced configuration, use RedisAgentStateStore.builder().

This implementation stores session state in Redis with the following key structure:

  • Single state: {prefix}{sessionId}:{stateKey} - Redis String containing JSON
  • List state: {prefix}{sessionId}:{stateKey}:list - Redis List containing JSON items
  • AgentStateStore marker: {prefix}{sessionId}:_keys - Redis Set tracking all state keys
  • Incremental list storage (only appends new items)
  • Type-safe state serialization using Jackson
  • Automatic session key tracking
Redis-based session implementation using Jedis.
  • Method Details

    • builder

      public static JedisAgentStateStore.Builder builder()
      Deprecated.
      Creates a new builder for JedisAgentStateStore.
      Returns:
      a new Builder instance
    • supportsVersioning

      public boolean supportsVersioning()
      Deprecated.
      Specified by:
      supportsVersioning in interface io.agentscope.core.state.AgentStateStore
    • save

      public void save(String userId, String sessionId, String key, io.agentscope.core.state.State value)
      Deprecated.
      Specified by:
      save in interface io.agentscope.core.state.AgentStateStore
    • getVersioned

      public <T extends io.agentscope.core.state.State> io.agentscope.core.state.VersionedState<T> getVersioned(String userId, String sessionId, String key, Class<T> type)
      Deprecated.
      Specified by:
      getVersioned in interface io.agentscope.core.state.AgentStateStore
    • saveIfVersion

      public long saveIfVersion(String userId, String sessionId, String key, io.agentscope.core.state.State value, long expectedVersion)
      Deprecated.
      Specified by:
      saveIfVersion in interface io.agentscope.core.state.AgentStateStore
    • save

      public void save(String userId, String sessionId, String key, List<? extends io.agentscope.core.state.State> values)
      Deprecated.
      Save a list of state values with hash-based change detection.

      This method uses hash-based change detection to handle both append-only and mutable lists:

      • If the hash changes (list was modified), the Redis list is deleted and recreated
      • If the list shrinks, the Redis list is deleted and recreated
      • If the list only grows (append-only), only new items are appended
      • If nothing changes, the operation is skipped
      Specified by:
      save in interface io.agentscope.core.state.AgentStateStore
      Parameters:
      userId - the user identifier
      sessionId - the session identifier
      key - the state key (e.g., "memory_messages")
      values - the list of state values to save
    • get

      public <T extends io.agentscope.core.state.State> Optional<T> get(String userId, String sessionId, String key, Class<T> type)
      Deprecated.
      Specified by:
      get in interface io.agentscope.core.state.AgentStateStore
    • getList

      public <T extends io.agentscope.core.state.State> List<T> getList(String userId, String sessionId, String key, Class<T> itemType)
      Deprecated.
      Specified by:
      getList in interface io.agentscope.core.state.AgentStateStore
    • exists

      public boolean exists(String userId, String sessionId)
      Deprecated.
      Specified by:
      exists in interface io.agentscope.core.state.AgentStateStore
    • delete

      public void delete(String userId, String sessionId)
      Deprecated.
      Specified by:
      delete in interface io.agentscope.core.state.AgentStateStore
    • listSessionIds

      public Set<String> listSessionIds(String userId)
      Deprecated.
      Specified by:
      listSessionIds in interface io.agentscope.core.state.AgentStateStore
    • close

      public void close()
      Deprecated.
      Specified by:
      close in interface io.agentscope.core.state.AgentStateStore
    • clearAllSessions

      public reactor.core.publisher.Mono<Integer> clearAllSessions()
      Deprecated.
      Clear all sessions stored in Redis (for testing or cleanup).
      Returns:
      Mono that completes with the number of deleted session keys