MCPcopy
hub / github.com/jackc/pgx / NewLRUCache

Function NewLRUCache

internal/stmtcache/lru_cache.go:29–42  ·  view source on GitHub ↗

NewLRUCache creates a new LRUCache. cap is the maximum size of the cache.

(cap int)

Source from the content-addressed store, hash-verified

27
28// NewLRUCache creates a new LRUCache. cap is the maximum size of the cache.
29func 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.
45func (c *LRUCache) Get(key string) *pgconn.StatementDescription {

Callers 2

connectFunction · 0.92
DeallocateAllMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected