Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/june-it/mystack.distributedlock4redis

开源的轻量级分布式锁类库
https://github.com/june-it/mystack.distributedlock4redis

distributedlock dotnet mystack redis

Last synced: 17 days ago
JSON representation

开源的轻量级分布式锁类库

Awesome Lists containing this project

README

        

# MyStack.DistributedLock4Redis

Open-source Lightweight Distributed Lock Library (Based on Redis)

| nuget | stats |
| ----------- | ----------- |
| [![nuget](https://img.shields.io/nuget/v/MyStack.DistributedLock4Redis.svg?style=flat-square)](https://www.nuget.org/packages/MyStack.DistributedLock4Redis) | [![stats](https://img.shields.io/nuget/dt/MyStack.DistributedLock4Redis.svg?style=flat-square)](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