Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultPatrolPeriod = 1 * time.Second
DefaultPatrolPeriod is an interval between collect loops
Variables ¶
View Source
var ( // ErrNotFound is returned when incremented or decremented element is not // found among tracked elements ErrNotFound = errors.New("element not found") )
Functions ¶
This section is empty.
Types ¶
type RefTracker ¶
type RefTracker struct {
// contains filtered or unexported fields
}
RefTracker is a collection of elements referenced by string keys. Once element reference count hits zero it will be removed after TTL unless new references will not appear.
func NewRefTracker ¶
func NewRefTracker(patrolPeriod time.Duration) *RefTracker
NewRefTracker starts RefTracker with
func Singleton ¶
func Singleton() *RefTracker
Singleton instantiates globally available reference tracker
func (*RefTracker) Decr ¶
func (rt *RefTracker) Decr(key string) error
Decr decrements reference count of an element
func (*RefTracker) Incr ¶
func (rt *RefTracker) Incr(key string) error
Incr increments reference count of an element
Click to show internal directories.
Click to hide internal directories.