Table of Contents

Class InMemoryAuditProvider

Namespace
WorkflowForge.Extensions.Audit
Assembly
WorkflowForge.Extensions.Audit.dll

In-memory audit provider for testing and development. Not recommended for production use.

public sealed class InMemoryAuditProvider : IAuditProvider
Inheritance
InMemoryAuditProvider
Implements
Inherited Members

Remarks

Entries are stored in insertion order. Once MaxEntries entries are held, writing another discards the oldest so memory use stays bounded.

Constructors

InMemoryAuditProvider()

Initializes an in-memory audit provider with the default entry cap.

public InMemoryAuditProvider()

InMemoryAuditProvider(int)

Initializes an in-memory audit provider with a custom entry cap.

public InMemoryAuditProvider(int maxEntries)

Parameters

maxEntries int

Maximum entries to retain; the oldest entry is discarded once the cap is reached.

Exceptions

ArgumentOutOfRangeException

Thrown when maxEntries is less than one.

Fields

DefaultMaxEntries

Default maximum number of audit entries retained in memory.

public const int DefaultMaxEntries = 10000

Field Value

int

Properties

Entries

Gets a snapshot of all audit entries.

[SuppressMessage("CodeQuality", "S2365", Justification = "Intentional snapshot semantics for thread-safe read access; changing to GetEntries() would break consumers")]
public IReadOnlyList<AuditEntry> Entries { get; }

Property Value

IReadOnlyList<AuditEntry>

MaxEntries

Gets the maximum number of entries retained.

public int MaxEntries { get; }

Property Value

int

Methods

Clear()

Clears all audit entries.

public void Clear()

FlushAsync(CancellationToken)

No-op for in-memory provider.

public Task FlushAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

WriteAuditEntryAsync(AuditEntry, CancellationToken)

Stores an audit entry in memory.

public Task WriteAuditEntryAsync(AuditEntry entry, CancellationToken cancellationToken = default)

Parameters

entry AuditEntry
cancellationToken CancellationToken

Returns

Task