-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13972 from abpframework/liangshiwei/distributedlock
- Loading branch information
Showing
8 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
....DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/AbpDistributedLockOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Volo.Abp.DistributedLocking; | ||
|
||
public class AbpDistributedLockOptions | ||
{ | ||
/// <summary> | ||
/// DistributedLock key prefix. | ||
/// </summary> | ||
public string KeyPrefix { get; set; } | ||
|
||
public AbpDistributedLockOptions() | ||
{ | ||
KeyPrefix = ""; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...stributedLocking.Abstractions/Volo/Abp/DistributedLocking/DistributedLockKeyNormalizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.Extensions.Options; | ||
using Volo.Abp.DependencyInjection; | ||
|
||
namespace Volo.Abp.DistributedLocking; | ||
|
||
public class DistributedLockKeyNormalizer : IDistributedLockKeyNormalizer, ITransientDependency | ||
{ | ||
protected AbpDistributedLockOptions Options { get; } | ||
|
||
public DistributedLockKeyNormalizer(IOptions<AbpDistributedLockOptions> options) | ||
{ | ||
Options = options.Value; | ||
} | ||
|
||
public virtual string NormalizeKey(string name) | ||
{ | ||
return $"{Options.KeyPrefix}{name}"; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...tributedLocking.Abstractions/Volo/Abp/DistributedLocking/IDistributedLockKeyNormalizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Volo.Abp.DistributedLocking; | ||
|
||
public interface IDistributedLockKeyNormalizer | ||
{ | ||
string NormalizeKey(string name); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters