Skip to content

floatdrop/slru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slru

Go Reference CI Coverage Go Report Card

Thread safe GoLang S(2)LRU cache.

Example

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
	}
}

Benchmarks

floatdrop/slru:
	BenchmarkSLRU_Rand-8   	 5600960	       206.9 ns/op	      44 B/op	       3 allocs/op
	BenchmarkSLRU_Freq-8   	 5927858	       201.0 ns/op	      43 B/op	       3 allocs/op

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages