Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultExpiry is used when Mutex Duration is 0 DefaultExpiry = 8 * time.Second // DefaultTries is used when Mutex Duration is 0 DefaultTries = 16 // DefaultDelay is used when Mutex Delay is 0 DefaultDelay = 512 * time.Millisecond // DefaultFactor is used when Mutex Factor is 0 DefaultFactor = 0.01 )
View Source
const ( DomainPerson = iota DomainGroup DomainOrg )
Variables ¶
View Source
var ( // ErrFailed is returned when lock cannot be acquired ErrFailed = errors.New("failed to acquire lock") )
Functions ¶
func SetDefaultMemcache ¶
Types ¶
type Locker ¶
type Locker interface { Lock() error Unlock() }
Locker interface with Lock returning an error when lock cannot be aquired
type MemcacheRWMutex ¶
type MemcacheRWMutex struct { RWMutex // contains filtered or unexported fields }
func NewMemcacheMutex ¶
func NewMemcacheMutex(name string, clients ...*memcache.Client) (mRWMutex *MemcacheRWMutex)
func (*MemcacheRWMutex) Lock ¶
func (this *MemcacheRWMutex) Lock() error
func (*MemcacheRWMutex) Unlock ¶
func (this *MemcacheRWMutex) Unlock()
type RWMutex ¶
type RWMutex struct { Name string Expiry time.Duration Tries int // Number of attempts to acquire lock before admitting failure, DefaultTries if 0 Delay time.Duration // Delay between two attempts to acquire lock, DefaultDelay if 0 Factor float64 // Drift factor, DefaultFactor if 0 // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.