NuGet ยท nuget

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.InMemory

Core Feature InMemory for Eltheon Framework

Install

Install-Kommandos

dotnet add package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.InMemory --version 0.9.1
<PackageReference Include="Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.InMemory" Version="0.9.1" />
paket add Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.InMemory --version 0.9.1
Install-Package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.InMemory -Version 0.9.1

README

Vorschau

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, ISessionInMemoryDatabase model the different lifetimes for cached data.
  • InMemoryDatabaseFactory and InMemoryQueueFactory deliver the correct implementation based on the requested scope (global vs. per-request).
  • Queue-related contracts (IInMemoryQueue, IQueueItem, QueueInfo) support async enqueue/dequeue, persistence via SaveQueuesAsync and inspection through diagnostic APIs.
  • Manager classes expose higher-level operations for consumers that do not need to manipulate the factories directly.

Usage

builder.Services.Configure<InMemoryOptions>(configuration.GetSection("InMemory"));
builder.Services.AddSingleton<IInMemoryDatabaseProvider, InProcessInMemoryProvider>();
builder.Services.AddSingleton<InMemoryDatabaseFactory>();
builder.Services.AddSingleton<IInMemoryQueue, InMemoryQueue>();
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(). To plug in Redis (or a different backing store) implement IInMemoryDatabaseProvider, register it, and set InMemory:Provider in configuration to point to your provider.

"InMemory": {
  "Provider": "InProcess"
}

Future providers can read additional properties (e.g., RedisConnectionString) from the same section.

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.