/// <summary> /// Acquires a named distributed lock with no expiration time within the current tenant. /// </summary> /// <param name="name">The name to use for the lock.</param> /// <returns>The acquired lock.</returns> /// <remarks>This method blocks indefinitely until the lock can be acquired.</remarks> public static IDistributedLock AcquireLock(this IDistributedLockService service, string name) { return(service.AcquireLock(name, null, null)); }
/// <summary> /// Acquires a named distributed lock with a given expiration time within the current tenant. /// </summary> /// <param name="name">The name of the lock to acquire.</param> /// <param name="maxValidFor">The maximum amount of time the lock should be held before automatically expiring. This is a safeguard in case the owner fails to release the lock. If <c>null</c> is specified, the lock never automatically expires.</param> /// <returns>The acquired lock.</returns> /// <remarks>This method blocks indefinitely until the lock can be acquired.</remarks> public static IDistributedLock AcquireLock(this IDistributedLockService service, string name, TimeSpan?maxValidFor) { return(service.AcquireLock(name, maxValidFor, null)); }