https://github.com/wanjun-cn/mystack.distributedlock4redis
Open-source Lightweight Distributed Lock Library (Based on Redis)
https://github.com/wanjun-cn/mystack.distributedlock4redis
distributedlock dotnet mystack redis
Last synced: 2 months ago
JSON representation
Open-source Lightweight Distributed Lock Library (Based on Redis)
- Host: GitHub
- URL: https://github.com/wanjun-cn/mystack.distributedlock4redis
- Owner: wanjun-cn
- License: mit
- Created: 2023-12-09T05:24:41.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-09-30T08:57:36.000Z (9 months ago)
- Last Synced: 2026-02-15T23:51:13.432Z (4 months ago)
- Topics: distributedlock, dotnet, mystack, redis
- Language: C#
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MyStack.DistributedLock4Redis
Open-source Lightweight Distributed Lock Library (Based on Redis)
| nuget | stats |
| ----------- | ----------- |
| [](https://www.nuget.org/packages/MyStack.DistributedLock4Redis) | [](https://www.nuget.org/stats/packages/MyStack.DistributedLock4Redis?groupby=Version) |
# Getting Started
## Add Service Support
```
services.AddDistributedLock4Redis(configure =>
{
configure.KeyPrefix = "MyStack";
configure.ConnectionString = "127.0.0.1:6379,password=123456";
});
```
## Using Distributed Locks
```
// Acquire Lock
using (var handle = await distributedLock.TryAcquireAsync("Foo"))
{
if (handle != null)
{
// Write your logical code
}
}
```
# License
MIT