Table of Contents

Class DistributedCacheQueryBehavior<TRequest, TResponse>

Namespace
Arbiter.CommandQuery.Behaviors
Assembly
Arbiter.CommandQuery.dll

A behavior for caching the response of a query to IDistributedCache. TRequest must implement ICacheResult for the response to be cached.

public class DistributedCacheQueryBehavior<TRequest, TResponse> : PipelineBehaviorBase<TRequest, TResponse>, IPipelineBehavior<TRequest, TResponse> where TRequest : class, IRequest<TResponse>

Type Parameters

TRequest

The type of the request.

TResponse

The type of the response.

Inheritance
PipelineBehaviorBase<TRequest, TResponse>
DistributedCacheQueryBehavior<TRequest, TResponse>
Implements
IPipelineBehavior<TRequest, TResponse>
Inherited Members

Constructors

DistributedCacheQueryBehavior(ILoggerFactory, IDistributedCache, IDistributedCacheSerializer)

Initializes a new instance of the DistributedCacheQueryBehavior<TRequest, TResponse> class.

public DistributedCacheQueryBehavior(ILoggerFactory loggerFactory, IDistributedCache distributedCache, IDistributedCacheSerializer distributedCacheSerializer)

Parameters

loggerFactory ILoggerFactory

The logger factory to create an ILogger from

distributedCache IDistributedCache

The distributed cache.

distributedCacheSerializer IDistributedCacheSerializer

The distributed cache serializer.

Exceptions

ArgumentNullException

Methods

Process(TRequest, RequestHandlerDelegate<TResponse>, CancellationToken)

Processes the specified request with the additional behavior.

protected override ValueTask<TResponse?> Process(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)

Parameters

request TRequest

The incoming request.

next RequestHandlerDelegate<TResponse>

Awaitable delegate for the next action in the pipeline. Eventually this delegate represents the handler.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<TResponse>

Awaitable task returning the TResponse