コード例 #1
0
 /// <summary>
 /// Gets a RedisLock using the factory's set of redis endpoints. You should check the IsAcquired property before performing actions.
 /// Blocks and retries up to the specified time limits.
 /// </summary>
 /// <param name="resource">The resource string to lock on. Only one RedisLock should be acquired for any given resource at once.</param>
 /// <param name="expiryTime">How long the lock should be held for.
 /// RedisLocks will automatically extend if the process that created the RedisLock is still alive and the RedisLock hasn't been disposed.</param>
 /// <param name="waitTime">How long to block for until a lock can be acquired.</param>
 /// <param name="retryTime">How long to wait between retries when trying to acquire a lock.</param>
 /// <returns>A RedisLock object.</returns>
 public RedisLock Create(string resource, TimeSpan expiryTime, TimeSpan waitTime, TimeSpan retryTime)
 {
     return(RedisLock.Create(redisCaches, resource, expiryTime, waitTime, retryTime));
 }
コード例 #2
0
 /// <summary>
 /// Gets a RedisLock using the factory's set of redis endpoints. You should check the IsAcquired property before performing actions.
 /// Blocks and retries up to the specified time limits.
 /// </summary>
 /// <param name="resource">The resource string to lock on. Only one RedisLock should be acquired for any given resource at once.</param>
 /// <param name="expiryTime">How long the lock should be held for.
 /// RedisLocks will automatically extend if the process that created the RedisLock is still alive and the RedisLock hasn't been disposed.</param>
 /// <param name="waitTime">How long to block for until a lock can be acquired.</param>
 /// <param name="retryTime">How long to wait between retries when trying to acquire a lock.</param>
 /// <param name="cancellationToken">CancellationToken to abort waiting for blocking lock.</param>
 /// <returns>A RedisLock object.</returns>
 public RedisLock Create(string resource, TimeSpan expiryTime, TimeSpan waitTime, TimeSpan retryTime, CancellationToken cancellationToken)
 {
     return(RedisLock.Create(redisCaches, resource, expiryTime, waitTime, retryTime, cancellationToken));
 }