Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributedMutex ¶
type DistributedMutex interface {
TryRunWithMutex(key string, timeout time.Duration, fn func()) error
}
DistributedMutex -
func NewRedisDistributedMutex ¶
func NewRedisDistributedMutex(redisOper ndb.RedisOper, lockTimeout time.Duration) DistributedMutex
NewRedisDistributedMutex - This is just an example, and it is recommended to use ETCD for distributed lock. In addition, This pattern is discouraged in favor of the Redlock(https://redis.io/topics/distlock) algorithm which is only a bit more complex to implement, but offers better guarantees and is fault tolerant.
type Server ¶
type Server interface { graceful.ShutdownServer }
Server -
func MustNewServer ¶
func MustNewServer(config *nconf.Config, opt ...ServerOption) Server
MustNewServer -
type ServerOption ¶
type ServerOption func(*serverOptions)
ServerOption -
func DistributedMutexOption ¶
func DistributedMutexOption(distributedMutex DistributedMutex) ServerOption
DistributedMutexOption -
Click to show internal directories.
Click to hide internal directories.