Versions in this module Expand all Collapse all v0 v0.0.3 Apr 14, 2021 Changes in this version + var ErrMaxTryGetLock = errors.New("all try get lock is failed") v0.0.2 Apr 14, 2021 Changes in this version + var DefPostgresOpts = PostgresOpts + var DefRedisOpts = RedisOpts + var ErrPostgresInvalidAddr = errors.New("invalid postgres address") + var ErrRedisInvalidAddr = errors.New("invalid redis address") + var ErrRedisInvalidPrefix = errors.New("invalid redis key prefix") + var ErrRedisKeyDoesNotExist = errors.New("key does not exist") + var ErrRedisMaxTryGetLock = errors.New("all try get lock is failed") + type Mutex interface + Lock func() error + Unlock func() error + type Postgres struct + func NewPostgres(conf PostgresOpts) (_ *Postgres, err error) + func (r *Postgres) NewMutex(key int64) (Mutex, error) + type PostgresMutex struct + func (s *PostgresMutex) Lock() error + func (s *PostgresMutex) Unlock() error + type PostgresOpts struct + DB string + Host string + MaxConnections int + Pass string + Port string + User string + type Redis struct + func NewRedis(conf RedisOpts) (*Redis, error) + func (r *Redis) NewMutex(key int64, tryCount int) (Mutex, error) + type RedisMutex struct + func (s *RedisMutex) Lock() error + func (s *RedisMutex) Unlock() error + type RedisOpts struct + DB int + Host string + Port string + Prefix string + type Synlock interface + NewMutex func(key int64) (Mutex, error) + func New(conn string) (Synlock, error)