Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MutexCache ¶
type MutexCache struct {
// contains filtered or unexported fields
}
func New ¶
func New(defaultExpiration time.Duration) *MutexCache
Returns a new instance of MutexCache. By default, a MutexCache instance has its cache checked and pruned every 30 seconds.
func (*MutexCache) Get ¶
func (m *MutexCache) Get(cacheKey string) *sync.Mutex
Checks for an existing mutex. If found, returns a *sync.Mutex (to prevent lock-copying issues), otherwise, creates a new *sync.Mutex, stores it using the instances default expiration, and returns that.
func (*MutexCache) GetWithExpiration ¶
Checks for an existing mutex. If found, returns a *sync.Mutex (to prevent lock-copying issues), otherwise, creates a new *sync.Mutex, stores it using the provided expiration param, and returns that.
Click to show internal directories.
Click to hide internal directories.