Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.InMemory
Overview
This feature provides the in-memory persistence primitives used across the Eltheon stack. It supplies scoped and global key/value stores, queue abstractions, factories and middleware that allow features such as Email, Search and AdminDashboard to exchange data without an external broker.
Components
IInMemoryDatabase,IGlobalInMemoryDatabase,ISessionInMemoryDatabasemodel the different lifetimes for cached data.InMemoryDatabaseFactoryandInMemoryQueueFactorydeliver the correct implementation based on the requested scope (global vs. per-request).- Queue-related contracts (
IInMemoryQueue,IQueueItem,QueueInfo) support async enqueue/dequeue, persistence viaSaveQueuesAsyncand inspection through diagnostic APIs. - Manager classes expose higher-level operations for consumers that do not need to manipulate the factories directly.
Usage
builder.Services.AddSingleton<IGlobalInMemoryDatabase, GlobalInMemoryDatabase>();
builder.Services.AddScoped<ISessionInMemoryDatabase, SessionInMemoryDatabase>();
builder.Services.AddSingleton<InMemoryDatabaseFactory>();
builder.Services.AddSingleton<InMemoryQueueFactory>();
Once registered, any feature can accept an InMemoryQueueFactory or InMemoryDatabaseFactory in its constructor and obtain the storage surface it needs by calling GetDatabase(isGlobal) or GetQueue().
Persistence
Queues and databases can be persisted to disk via the SaveQueuesAsync/LoadQueuesAsync APIs. Ensure GlobalConfig paths are initialized so persistence targets exist.
Diagnostics
Because the implementation is in-memory, restarts clear volatile queues unless SaveQueuesAsync is called. Use the factory abstractions to hook custom instrumentation (e.g., wrapping IInMemoryQueue with your own decorator) when you need to track queue depth or latency.