Class NoLockStrategy
- Namespace
- Compendium.Core.Domain.Primitives
- Assembly
- Compendium.Core.dll
No-locking strategy that provides maximum performance for single-threaded scenarios. WARNING: Should only be used when thread safety is guaranteed by external means.
public sealed class NoLockStrategy : ILockingStrategy, IDisposable
- Inheritance
-
NoLockStrategy
- Implements
- Inherited Members
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
ExecuteReadAsync<T>(Func<Task<T>>, CancellationToken)
Executes an async read operation with appropriate locking.
public 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.
public 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.
public void ExecuteWrite(Action operation)
Parameters
operationActionThe operation to execute.
ExecuteWriteAsync(Func<Task>, CancellationToken)
Executes an async write operation with appropriate locking.
public 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.