https://github.com/medigo/go-dlm
A Distributed Lock Manager abstraction library for Go
https://github.com/medigo/go-dlm
distributed-locks dlm go locks
Last synced: 10 months ago
JSON representation
A Distributed Lock Manager abstraction library for Go
- Host: GitHub
- URL: https://github.com/medigo/go-dlm
- Owner: MEDIGO
- License: apache-2.0
- Created: 2016-09-09T09:37:06.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-12T10:03:28.000Z (over 7 years ago)
- Last Synced: 2024-06-21T13:56:00.658Z (almost 2 years ago)
- Topics: distributed-locks, dlm, go, locks
- Language: Go
- Size: 12.7 KB
- Stars: 10
- Watchers: 7
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-dlm
[](https://godoc.org/github.com/MEDIGO/go-dlm)
[](https://circleci.com/gh/MEDIGO/go-dlm)
This package provides an abstraction library for multiple Distributed Lock Manager backends.
As the moment, go-dlm only supports [Redis](http://redis.io/) and an in-memory implementation intended to be used during development.
## Usage
```go
// Create a DLM
dlm, err := NewRedisLock("localhost:6379")
if err != nil {
panic(err)
}
// Create a lock
lock, err := dlm.NewLock("resource", nil)
if err != nil {
panic(err)
}
// Acquire the lock
if err := lock.Lock(); err != nil {
panic(err)
}
// Release the lock
if err := lock.Unlock(); err != nil {
panic(err)
}
```
## Copyright and license
Copyright © 2016 MEDIGO GmbH. go-dlm is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.