Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultPromoter ¶
type DefaultPromoter struct{}
DefaultPromoter promotes if the given key QPS is higher than the QPS of the least recently accessed element in the hotcache
func (*DefaultPromoter) ShouldPromote ¶
func (p *DefaultPromoter) ShouldPromote(key string, data []byte, stats Stats) bool
ShouldPromote for a DefaultPromoter promotes if the given key QPS is higher than the QPS of the least recently accessed element in the hotcache
type HCStats ¶
HCStats keeps track of the size, capacity, and coldest/hottest elements in the hot cache
type Interface ¶
Interface is the interface for determining whether a key/value pair should be added to the hot cache
type PreviouslyKnownPromoter ¶
type PreviouslyKnownPromoter struct{}
PreviouslyKnownPromoter implements Promoter and promotes the given key if the key has been seen before (was previously present in the candidate cache).
func (*PreviouslyKnownPromoter) ShouldPromote ¶
func (p *PreviouslyKnownPromoter) ShouldPromote(key string, data []byte, stats Stats) bool
ShouldPromote for the PreviouslyKnownPromoter promotes if the Hits value is non-zero, indicating that the key has been seen before.
type ProbabilisticPromoter ¶
type ProbabilisticPromoter struct {
ProbDenominator int
}
ProbabilisticPromoter promotes based on a 1/ProbDenominator chance
func (*ProbabilisticPromoter) ShouldPromote ¶
func (p *ProbabilisticPromoter) ShouldPromote(key string, data []byte, stats Stats) bool
ShouldPromote for a ProbabilisticPromoter promotes based on a 1/ProbDenominator chance
type Stats ¶
type Stats struct {
// Request-rate for this key (possibly with some windowing applied)
KeyQPS float64
// Number of hits for this key (also possibly with some windowing applied)
// This will be zero if there is no record of this key (not seen before
// or tracking expired)
Hits int64
HCStats *HCStats
}
Stats contains both the KeyQPS and a pointer to the galaxy-wide HCStats