类 InMemoryMemory

java.lang.Object
io.agentscope.core.memory.InMemoryMemory
所有已实现的接口:
Memory

@Deprecated(forRemoval=true, since="2.0.0") public class InMemoryMemory extends Object implements Memory
已过时, 待删除: 此 API 元素将从以后的版本中删除。
since 2.0.0. Conversation context lives on AgentState.getContext(); this class is retained for source compatibility with 1.0.x user code.
In-memory implementation of Memory with state persistence support. This implementation stores messages in memory using thread-safe collections and provides state serialization/deserialization for session management.
  • 构造器概要

    构造器
    构造器
    说明
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Constructor for InMemoryMemory.
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    addMessage(Msg message)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Adds a message to the in-memory message list.
    void
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Clears all messages from memory.
    void
    deleteMessage(int index)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Deletes a message at the specified index.
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Retrieves all non-null messages from memory.
    void
    loadFrom(AgentStateStore stateStore, String userId, String sessionId)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Load memory state from the store.
    void
    saveTo(AgentStateStore stateStore, String userId, String sessionId)
    已过时, 待删除: 此 API 元素将从以后的版本中删除。
    Save memory state to the session.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • InMemoryMemory

      public InMemoryMemory()
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      Constructor for InMemoryMemory.
  • 方法详细资料

    • saveTo

      public void saveTo(AgentStateStore stateStore, String userId, String sessionId)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      Save memory state to the session.

      Passes the full message list to the session, including the case where the list is empty. The AgentStateStore implementation is responsible for incremental storage (e.g., JsonFileAgentStateStore appends only new items based on file line count).

      指定者:
      saveTo 在接口中 Memory
      参数:
      stateStore - the state store to save to
      userId - the user identifier
      sessionId - the session identifier
    • loadFrom

      public void loadFrom(AgentStateStore stateStore, String userId, String sessionId)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      Load memory state from the store.
      指定者:
      loadFrom 在接口中 Memory
      参数:
      stateStore - the state store to load from
      userId - nullable user identifier
      sessionId - session identifier
    • addMessage

      public void addMessage(Msg message)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      Adds a message to the in-memory message list.

      This method is thread-safe due to the use of CopyOnWriteArrayList.

      指定者:
      addMessage 在接口中 Memory
      参数:
      message - The message to add to memory
    • getMessages

      public List<Msg> getMessages()
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      Retrieves all non-null messages from memory.

      This method filters out any null entries and returns a new list copy. Thread-safe for concurrent reads.

      指定者:
      getMessages 在接口中 Memory
      返回:
      A new list containing all non-null messages
    • deleteMessage

      public void deleteMessage(int index)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      Deletes a message at the specified index.

      This method is thread-safe due to the use of CopyOnWriteArrayList. If the index is out of bounds, this operation is a no-op (no exception thrown).

      指定者:
      deleteMessage 在接口中 Memory
      参数:
      index - The index of the message to delete (0-based)
    • clear

      public void clear()
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      Clears all messages from memory.

      This method is thread-safe due to the use of CopyOnWriteArrayList.

      指定者:
      clear 在接口中 Memory