Documentation ¶
Overview ¶
Package cache provides a time cache implementation safe for concurrent use without the need of additional locking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimeCache ¶
type TimeCache struct {
// contains filtered or unexported fields
}
TimeCache provides a time cache safe for concurrent use by multiple goroutines without additional locking or coordination.
func NewTimeCache ¶
NewTimeCache creates a new cache instance with provided timespan.
func (*TimeCache) Add ¶
Add adds an entry to the cache. Returns `true` if entry was not present in the cache and was successfully added into it. Returns `false` if entry is already in the cache. This method is synchronized.
Click to show internal directories.
Click to hide internal directories.