NewLRUCache creates a new LRUCache. cap is the maximum size of the cache.
(cap int)
| 27 | |
| 28 | // NewLRUCache creates a new LRUCache. cap is the maximum size of the cache. |
| 29 | func NewLRUCache(cap int) *LRUCache { |
| 30 | head := &lruNode{} |
| 31 | tail := &lruNode{} |
| 32 | head.next = tail |
| 33 | tail.prev = head |
| 34 | |
| 35 | return &LRUCache{ |
| 36 | cap: cap, |
| 37 | m: make(map[string]*lruNode, cap), |
| 38 | head: head, |
| 39 | tail: tail, |
| 40 | invalidSet: make(map[string]struct{}), |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // Get returns the statement description for sql. Returns nil if not found. |
| 45 | func (c *LRUCache) Get(key string) *pgconn.StatementDescription { |
no outgoing calls
no test coverage detected