Table of Contents

Class CacheReentrancyException

Namespace
Excalibur.Dispatch.Caching
Assembly
Excalibur.Dispatch.Caching.dll

Thrown when a handler whose result is cached dispatches another message that resolves to the cache key currently being produced, directly or through a further dispatch.

public sealed class CacheReentrancyException : InvalidOperationException, ISerializable
Inheritance
CacheReentrancyException
Implements
Inherited Members
Extension Methods

Remarks

The inner dispatch waits for the outer one to publish its value, and the outer cannot publish until the inner returns, so the request would never complete. The cycle is a fault in the handler's own composition, not a fault of the cache backend, and it is reported rather than absorbed: it is deliberately excluded from the fail-open fallback that covers backend errors, because falling back would run the handler a second time and return success while leaving the cycle in place and invisible.

Resolve it by giving the two messages distinct cache keys, or by moving the nested dispatch outside the cached handler.

Derives from InvalidOperationException because the condition is a misuse of the dispatch pipeline rather than a transient failure; retrying without changing the handler or the keys produces the same result.

Constructors

CacheReentrancyException()

Initializes a new instance of the CacheReentrancyException class.

public CacheReentrancyException()

CacheReentrancyException(string)

Initializes a new instance of the CacheReentrancyException class with a specified error message.

public CacheReentrancyException(string message)

Parameters

message string

The message that describes the error.

CacheReentrancyException(string, Exception)

Initializes a new instance of the CacheReentrancyException class with a specified error message and a reference to the inner exception that caused it.

public CacheReentrancyException(string message, Exception innerException)

Parameters

message string

The message that describes the error.

innerException Exception

The exception that caused the current exception.

CacheReentrancyException(string, string?)

Initializes a new instance of the CacheReentrancyException class for a specific cache key.

public CacheReentrancyException(string message, string? cacheKey)

Parameters

message string

The message that describes the error.

cacheKey string

The resolved cache key that was re-entered.

Properties

CacheKey

Gets the resolved cache key that was re-entered while it was being produced.

public string? CacheKey { get; }

Property Value

string

The cache key, or null when the key was not supplied.