=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -8,6 +8,7 @@ namespace adas_core.Application.Services.Caching
/// Lock distribuido en Redis. Usa token por adquisición (owner)
/// y liberación segura con script Lua: borra la key solo si el valor coincide.
/// </summary>
/// <!-- aidoc:v1 sig=db4fe1b -->
public class RedisLockProvider(Func<IDatabase?> getDatabase) : ILockProvider
{
private readonly string _prefix = "lock:";
@@ -31,6 +32,7 @@ namespace adas_core.Application.Services.Caching
/// <param name="key">The identifier of the resource to lock.</param>
/// <param name="timeout">The maximum duration to keep retrying before giving up.</param>
/// <returns><c>true</c> if the lock was successfully acquired; otherwise, <c>false</c>.</returns>
/// <!-- aidoc:v1 sig=4b91964 body=b8dd956 -->
public async Task<bool> AcquireAsync(string key, TimeSpan timeout)
{
var redis = getDatabase();
@@ -58,6 +60,7 @@ namespace adas_core.Application.Services.Caching
/// Asynchronously releases the token associated with the specified key by removing it from the in-memory token store and executing a Lua release script against Redis. If the key is not found in the local store, or the Redis database is unavailable, the method returns without performing any further action.
/// </summary>
/// <param name="key">The identifier of the token to release.</param>
/// <!-- aidoc:v1 sig=03497b0 body=db68b0e -->
public async Task ReleaseAsync(string key)
{
if (!_tokens.TryRemove(key, out var token))