Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const (
DefaultProbationRatio = 0.2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Evicted ¶
type Evicted[K comparable, V any] struct { Key K Value V }
Evicted holds key/value pair that was evicted from cache.
type SLRU ¶
type SLRU[K comparable, V any] struct { // contains filtered or unexported fields }
Example ¶
package main import ( "fmt" slru "github.com/floatdrop/slru" ) func main() { cache := slru.New[string, int](256) cache.Set("Hello", 5) if e := cache.Get("Hello"); e != nil { fmt.Println(*e) } }
Output: 5
Click to show internal directories.
Click to hide internal directories.