locker

package module
v0.0.0-...-a988fe2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2018 License: MIT Imports: 3 Imported by: 0

README

Go Locker Last release

Go Report Card

Branch Status Coverage
master Build Status Coveralls
develop Build Status Coveralls

Distributed Lock Manager

Example

import "github.com/euskadi31/go-locker"

rds := redis.New()

locker := server.NewRedisLocker(rds)

locker.Lock("foo", 1*time.Hour)
defer locker.Unlock("foo")

locker.IsLocked("foo") // true or false

License

go-locker is licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

type Locker interface {
	Lock(key string, ttl time.Duration) error
	Unlock(key string) error
	IsLocked(key string) bool
}

Locker interface

func NewMemoryLocker

func NewMemoryLocker() Locker

NewMemoryLocker constructor

func NewRedisLocker

func NewRedisLocker(rds rc.Cmdable) Locker

NewRedisLocker constructor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL