Interface IMemoryMessageHistory
- All Known Implementing Classes:
MemoryMessageHistory
public interface IMemoryMessageHistory
Interface for managing chat message history in memory.
Provides methods for clearing, checking, loading, and saving chat message history.
Implementations of this interface interact with a persistence mechanism to store
and retrieve
MessageHistory
objects.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the stored chat message history from memory.isEmpty()
Checks if the stored chat message history is empty.load()
Loads the chat message history from memory.void
save
(MessageHistory messageHistory) Saves the givenMessageHistory
object to memory.
-
Field Details
-
KEY
Key used for storing and retrieving the message history in the persistence layer.- See Also:
-
-
Method Details
-
clear
void clear()Clears the stored chat message history from memory. Deletes the data associated with the keyKEY
in the persistence mechanism. -
isEmpty
Boolean isEmpty()Checks if the stored chat message history is empty.- Returns:
true
if the stored message history is empty or null;false
otherwise.
-
load
MessageHistory load()Loads the chat message history from memory.- Returns:
- the
MessageHistory
object, ornull
if deserialization fails or no data is found.
-
save
Saves the givenMessageHistory
object to memory.- Parameters:
messageHistory
- theMessageHistory
object to save.
-