package stmtcache
Import Path
github.com/jackc/pgx/v5/internal/stmtcache (on go.dev)
Dependency Relation
imports 3 packages, and imported by one package
Package-Level Type Names (total 3, in which 2 are exported)
Cache caches statement descriptions.
Cap returns the maximum number of cached prepared statement descriptions.
Get returns the statement description for sql. Returns nil if not found.
GetInvalidated returns a slice of all statement descriptions invalidated since the last call to RemoveInvalidated.
Invalidate invalidates statement description identified by sql. Does nothing if not found.
InvalidateAll invalidates all statement descriptions.
Len returns the number of cached prepared statement descriptions.
Put stores sd in the cache. Put panics if sd.SQL is "". Put does nothing if sd.SQL already exists in the cache.
RemoveInvalidated removes all invalidated statement descriptions. No other calls to Cache must be made between a
call to GetInvalidated and RemoveInvalidated or RemoveInvalidated may remove statement descriptions that were
never seen by the call to GetInvalidated.
*LRUCache
func github.com/jackc/pgx/v5.(*Conn).sendBatchExtendedWithDescription(ctx context.Context, b *pgx.Batch, distinctNewQueries []*pgconn.StatementDescription, sdCache Cache) (pbr *pgx.pipelineBatchResults)
LRUCache implements Cache with a Least Recently Used (LRU) cache.
cap int
freelist *lruNode
head *lruNode
invalidSet map[string]struct{}
invalidStmts []*pgconn.StatementDescription
len int
m map[string]*lruNode
tail *lruNode
Cap returns the maximum number of cached prepared statement descriptions.
Get returns the statement description for sql. Returns nil if not found.
GetInvalidated returns a slice of all statement descriptions invalidated since the last call to RemoveInvalidated.
Invalidate invalidates statement description identified by sql. Does nothing if not found.
InvalidateAll invalidates all statement descriptions.
Len returns the number of cached prepared statement descriptions.
Put stores sd in the cache. Put panics if sd.SQL is "". Put does nothing if sd.SQL already exists in the cache or
sd.SQL has been invalidated and HandleInvalidated has not been called yet.
RemoveInvalidated removes all invalidated statement descriptions. No other calls to Cache must be made between a
call to GetInvalidated and RemoveInvalidated or RemoveInvalidated may remove statement descriptions that were
never seen by the call to GetInvalidated.
(*LRUCache) allocNode() *lruNode
(*LRUCache) freeNode(node *lruNode)
(*LRUCache) insertAfter(at, node *lruNode)
(*LRUCache) invalidateOldest()
(*LRUCache) moveToFront(node *lruNode)
(*LRUCache) unlink(node *lruNode)
*LRUCache : Cache
func NewLRUCache(cap int) *LRUCache
Package-Level Functions (total 2, both are exported)
NewLRUCache creates a new LRUCache. cap is the maximum size of the cache.
StatementName returns a statement name that will be stable for sql across multiple connections and program
executions.
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)