类 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 元素将从以后的版本中删除。
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.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddMessage(Msg message) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Adds a message to the in-memory message list.voidclear()已过时, 待删除: 此 API 元素将从以后的版本中删除。Clears all messages from memory.voiddeleteMessage(int index) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Deletes a message at the specified index.已过时, 待删除: 此 API 元素将从以后的版本中删除。Retrieves all non-null messages from memory.voidloadFrom(AgentStateStore stateStore, String userId, String sessionId) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Load memory state from the store.voidsaveTo(AgentStateStore stateStore, String userId, String sessionId) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Save memory state to the session.
-
构造器详细资料
-
InMemoryMemory
public InMemoryMemory()已过时, 待删除: 此 API 元素将从以后的版本中删除。Constructor for InMemoryMemory.
-
-
方法详细资料
-
saveTo
已过时, 待删除: 此 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).
-
loadFrom
已过时, 待删除: 此 API 元素将从以后的版本中删除。Load memory state from the store. -
addMessage
已过时, 待删除: 此 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
已过时, 待删除: 此 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.
-
AgentState.getContext(); this class is retained for source compatibility with 1.0.x user code.