MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / Get

Method Get

cache/lru.go:41–49  ·  view source on GitHub ↗

Get value from lru if not found, return nil

(key string)

Source from the content-addressed store, hash-verified

39// Get value from lru
40// if not found, return nil
41func (c *LRU) Get(key string) any {
42 v, ok := c.storage[key]
43 if ok {
44 c.dl.MoveToBack(v)
45 return v.Val.(item).value
46 }
47
48 return nil
49}
50
51// Put cache with key and value to lru
52func (c *LRU) Put(key string, value any) {

Callers 1

TestLRUFunction · 0.95

Calls 1

MoveToBackMethod · 0.80

Tested by 1

TestLRUFunction · 0.76