Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is a pool of locks that can be used to lock based on a key.
func NewPool ¶
NewPool creates a new pool of locks, where amount is the number of locks to create. It returns an error if the amount is less than or equal to 0. The ideal amount of locks is dependent on the number of threads. With a factor that depends on the amount of collision you want per lock. Example:
threads := 7 // Collision of 25% per lock amount := threads * (100 / 25) // => 7 * 4 = 28
type RWPool ¶
type RWPool struct {
// contains filtered or unexported fields
}
func NewRWPool ¶
NewRWPool creates a new pool of locks, where amount is the number of locks to create. Instead of mutexes, it uses RWMutexes.
Click to show internal directories.
Click to hide internal directories.