MentorAgent Docs
Menu

Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.

ReferencePackage: Novior.MentorAgent

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():

Example
// Redis
builder.Services.AddSingleton<IMentorMemoryStore, RedisMemoryStore>();

// EF Core
builder.Services.AddScoped<IMentorMemoryStore, EfCoreMemoryStore>();

// MongoDB
builder.Services.AddSingleton<IMentorMemoryStore, MongoMemoryStore>();

builder.Services.AddMentorAgent(options => { ... });

Namespace: Novior.MentorAgent.Memory. Package: Novior.MentorAgent.

public interface IMentorMemoryStore

Terminal
dotnet add package Novior.MentorAgent

Task ClearAsync(string userId, CancellationToken ct = default)

Deletes all memory entries for a user.

Task DeleteAsync(string userId, string key, CancellationToken ct = default)

Deletes a specific memory entry.

Task<string?> GetAsync(string userId, string key, CancellationToken ct = default)

Retrieves a specific memory entry by key. Returns null if not found.

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.

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.