Skip to content

Implementation of distributed locking with Redis

License

Notifications You must be signed in to change notification settings

saromanov/redisdl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redisdl

Build Status Go Report Card Coverage Status

Implementation of distributed locking over Redis

Example

package main

import (
	"context"

	"github.com/go-redis/redis"
	"github.com/saromanov/redisdl"
)

func main() {
	client := redis.NewClient(&redis.Options{
		Network: "tcp",
		Addr:    "127.0.0.1:6379",
	})
	defer client.Close()
	dl, err := redisdl.New(&redisdl.Options{
		Client:     client,
		Key:        "fun.lock",
		RetryCount: 3,
	})
	if err != nil {
		panic(err)
	}
	dl.Lock(context.Background())
	defer dl.Unlock()
}

About

Implementation of distributed locking with Redis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages