Documentation ¶
Overview ¶
Package ring implements a ring data structure for efficiently storing the n most recent entries added to it. The ring data structure is comparable to a ring buffer, but with only one pointer for writing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry interface{}
Entry is the Entry type stored in the data structure. You may want to change the type from interface{} to something else if you're actually using this.
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring implements a ring data structure.
func (*Ring) Add ¶
Add adds an entry to the ring, appending it if the ring hasn't reached its capacity yet, or otherwise replacing the oldest entry.
Click to show internal directories.
Click to hide internal directories.