Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interlock

Build Status Coverage Status Go Report Card

Package implements inter service lock based on different external storages.

Example

package main

import (
  "fmt"
  "log"
  "time"

  "github.com/demdxx/interlock/redislock"
  "github.com/demdxx/interlock"
)

func main() {
  const defaultLifetime = time.Minute
  rlock, err := redislock.NewByURL(`redis://host:3456/1?pool=10&max_retries=2&idle_cons=2`, defaultLifetime)
  if err != nil {
    log.Fatal(err)
  }

  if rlock.TryLock("start") {
    fmt.Println("I'm the first!")
  } else {
    fmt.Println("Someone ran first")
  }
}

TODO

  • Zookeeper
  • Consul
  • Aerospike
  • Memcached
  • Redis

About

Interprocess lock

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages