Interface ILockingStrategy
- Namespace
- Compendium.Core.Domain.Primitives
- Assembly
- Compendium.Core.dll
Defines a strategy for locking operations in aggregate roots. Enables different locking approaches based on performance requirements.
public interface ILockingStrategy : IDisposable
- Inherited Members
Methods
ExecuteReadAsync<T>(Func<Task<T>>, CancellationToken)
Executes an async read operation with appropriate locking.
Task<T> ExecuteReadAsync<T>(Func<Task<T>> operation, CancellationToken cancellationToken = default)
Parameters
operationFunc<Task<T>>The operation to execute.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<T>
The result of the operation.
Type Parameters
TThe return type of the operation.
ExecuteRead<T>(Func<T>)
Executes a read operation with appropriate locking.
T ExecuteRead<T>(Func<T> operation)
Parameters
operationFunc<T>The operation to execute.
Returns
- T
The result of the operation.
Type Parameters
TThe return type of the operation.
ExecuteWrite(Action)
Executes a write operation with appropriate locking.
void ExecuteWrite(Action operation)
Parameters
operationActionThe operation to execute.
ExecuteWriteAsync(Func<Task>, CancellationToken)
Executes an async write operation with appropriate locking.
Task ExecuteWriteAsync(Func<Task> operation, CancellationToken cancellationToken = default)
Parameters
operationFunc<Task>The operation to execute.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the async operation.