Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StyleHandler ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a collection of Pairs with a fixed capacity.
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
}
Logger knows how to log messages.
type Popularity ¶
type Popularity struct {
// contains filtered or unexported fields
}
Popularity keeps track of pairs and allow to generate an HTML representation of the newest ones. It has a miximum capcacity of pairs: when adding new pairs, the surplus oldest ones will be forgotten.
The Add and HTML methods are thread-safe.
func NewPopularity ¶
func NewPopularity(cap int) (*Popularity, error)
NewPopularity returns a new Popularity with the given capacity.
func (*Popularity) Add ¶
func (p *Popularity) Add(pairs ...pair.Pair) error
Add adds the given pairs to the web page.
func (*Popularity) HTML ¶
func (p *Popularity) HTML() []byte
HTML returns a web page with the newest pairs added.
Click to show internal directories.
Click to hide internal directories.