Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { KeyPresent(key string) bool GetValue(key string) (Entry, error) SetValue(key string, value Entry) error }
Cache is the thing the server knows how to ask about the existance of a particular entry. Various implementations can be built that correspond to this interface
type Calecar ¶
type Calecar struct {
// contains filtered or unexported fields
}
Calecar balances a frequency and recency distribution https://www.usenix.org/system/files/conference/hotstorage18/hotstorage18-paper-vietri.pdf
func (*Calecar) KeyPresent ¶
KeyPresent is true if the key is in the cache right now
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry is the thing stored in a cache, both the actual value of the result and the measured cost to recompute it
type FiFo ¶
type FiFo struct {
// contains filtered or unexported fields
}
FiFo is a First-in-fist-out cache implementation. When full, it will always decide to evict the oldest key added.
func (*FiFo) KeyPresent ¶
KeyPresent is true if the key is in the cache right now
type Lcr ¶
type Lcr struct {
// contains filtered or unexported fields
}
Lcr is a cache implementation adapting to cost of recomputation. When full, it will always decide to evict the key with the lowest cost to recompute.
func (*Lcr) KeyPresent ¶
KeyPresent is true if the key is in the cache right now
type Lecar ¶
type Lecar struct {
// contains filtered or unexported fields
}
Lecar balances a frequency and recency distribution https://www.usenix.org/system/files/conference/hotstorage18/hotstorage18-paper-vietri.pdf
func (*Lecar) KeyPresent ¶
KeyPresent is true if the key is in the cache right now
type Lfu ¶
type Lfu struct {
// contains filtered or unexported fields
}
Lfu is a cache implementation adapting to access frequency. When full, it will always decide to evict the key touched the least number of times.
func (*Lfu) KeyPresent ¶
KeyPresent is true if the key is in the cache right now
type Lru ¶
type Lru struct {
// contains filtered or unexported fields
}
Lru is a cache implementation adapting to access time. When full, it will always decide to evict the key touched the longest ago.
func (*Lru) KeyPresent ¶
KeyPresent is true if the key is in the cache right now
type NoOp ¶
type NoOp struct{}
NoOp is a dummy implementation. No keys are ever present, so it never has to replace anything. Naive baseline.
func (*NoOp) KeyPresent ¶
KeyPresent will always be false for the no-op cache