Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/calmh/deprecated_lfucache
DEPRECATION WARNING This package is unmaintained and probably not what you're looking for.
import "github.com/calmh/lfucache"
Package lfucache implements an O(1) LFU cache structure.
This structure is described in the paper "An O(1) algorithm for implementing the LFU cache eviction scheme" by K. Shah, A. Mitra and D. Matani.
It is based on two levels of doubly linked lists and gives O(1) insert, access and delete operations. The cache supports sending evicted items to interested listeners via channels, and manually evicting all cache items matching a criteria. This is useful for example when using the package as a write cache for a database, where items must be written to the backing store on eviction.
The cache structure is not thread safe.
c := lfucache.Create(1024) // The cache will hold up to 1024 items.
c.Access("mykey") // => nil, false
c.Insert("mykey", 2345) // => true
v, ok := c.Access("mykey") // => v = interface{}{2345}, ok = true
c.Delete("mykey") // => true
http://godoc.org/github.com/calmh/lfucache
MIT
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.