Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MemHashString ¶
MemHashString provides fast hashing for strings
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a thread-safe LRU cache that utilizes map sharding to provide parallel acess to elements and batching to reduce cache lock time it means that it has eventual element priority update and removal rather than immediate ones
func NewCache ¶
func NewCache(cp uint, conf *CacheConfig) *Cache
New cache return Cache with specified config default thresholds are cap*0.02 + 2 for getThresh and cap*0.01 + 2 fof delThresh
type CacheConfig ¶
CacheConfig controls when cache metadata updates values update their priorities when more than GetThresh values were accessed and remove when size of cache exceeds its capacity + DelThresh to implement immediate updates set both thresholds to 0
Click to show internal directories.
Click to hide internal directories.