IMentorMemoryStore interface
The IMentorMemoryStore interface of Novior.MentorAgent.Memory: Interface for persisting the Mentor AI contextual memory. MentorAgent registers…
On this page
Interface for persisting the Mentor AI contextual memory. MentorAgent registers InMemoryMentorMemoryStore by default (RAM, zero config). For real persistence, register your own implementation BEFORE AddMentorAgent():
// Redis
builder.Services.AddSingleton<IMentorMemoryStore, RedisMemoryStore>();
// EF Core
builder.Services.AddScoped<IMentorMemoryStore, EfCoreMemoryStore>();
// MongoDB
builder.Services.AddSingleton<IMentorMemoryStore, MongoMemoryStore>();
builder.Services.AddMentorAgent(options => { ... });Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Memory. Package: Novior.MentorAgent.
public interface IMentorMemoryStore
dotnet add package Novior.MentorAgentMethods
Section titled “Methods”ClearAsync
Section titled “ClearAsync”Task ClearAsync(string userId, CancellationToken ct = default)
Deletes all memory entries for a user.
DeleteAsync
Section titled “DeleteAsync”Task DeleteAsync(string userId, string key, CancellationToken ct = default)
Deletes a specific memory entry.
GetAsync
Section titled “GetAsync”Task<string?> GetAsync(string userId, string key, CancellationToken ct = default)
Retrieves a specific memory entry by key. Returns null if not found.
GetRecentAsync
Section titled “GetRecentAsync”Task<IReadOnlyList<MemoryEntry>> GetRecentAsync(string userId, int count = 10, CancellationToken ct = default)
Retrieves the most recent N entries for the user, ordered by date descending.
SaveAsync
Section titled “SaveAsync”Task SaveAsync(string userId, string key, string value, CancellationToken ct = default)
Saves a memory entry for a user.
Parameters
userId: Unique user ID. Use "anonymous" if not authenticated.key: Memory key (e.g. "last_action", "preferred_filter")value: Serialized value (string, JSON, etc.)ct: Cancels the save.
