mirror of https://github.com/abpframework/abp.git
committed by
GitHub
8 changed files with 101 additions and 7 deletions
@ -0,0 +1,14 @@ |
|||
namespace Volo.Abp.DistributedLocking; |
|||
|
|||
public class AbpDistributedLockOptions |
|||
{ |
|||
/// <summary>
|
|||
/// DistributedLock key prefix.
|
|||
/// </summary>
|
|||
public string KeyPrefix { get; set; } |
|||
|
|||
public AbpDistributedLockOptions() |
|||
{ |
|||
KeyPrefix = ""; |
|||
} |
|||
} |
|||
@ -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}"; |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace Volo.Abp.DistributedLocking; |
|||
|
|||
public interface IDistributedLockKeyNormalizer |
|||
{ |
|||
string NormalizeKey(string name); |
|||
|
|||
} |
|||
Loading…
Reference in new issue