package stmtcache

Import Path
	github.com/jackc/pgconn/stmtcache (on go.dev)

Dependency Relation
	imports 5 packages, and imported by one package

Involved Source Files lru.go Package stmtcache is a cache that can be used to implement lazy prepared statements.
Package-Level Type Names (total 2, both are exported)
/* sort exporteds by: | */
Cache prepares and caches prepared statement descriptions. Cap returns the maximum number of cached prepared statement descriptions. Clear removes all entries in the cache. Any prepared statements will be deallocated from the PostgreSQL session. Get returns the prepared statement description for sql preparing or describing the sql on the server as needed. Len returns the number of cached prepared statement descriptions. Mode returns the mode of the cache (ModePrepare or ModeDescribe) StatementErrored informs the cache that the given statement resulted in an error when it was last used against the database. In some cases, this will cause the cache to maer that statement as bad. The bad statement will instead be flushed during the next call to Get that occurs outside of a failed transaction. *LRU func New(conn *pgconn.PgConn, mode int, cap int) Cache func github.com/jackc/pgx/v4.(*Conn).StatementCache() Cache
LRU implements Cache with a Least Recently Used (LRU) cache. Cap returns the maximum number of cached prepared statement descriptions. Clear removes all entries in the cache. Any prepared statements will be deallocated from the PostgreSQL session. Get returns the prepared statement description for sql preparing or describing the sql on the server as needed. Len returns the number of cached prepared statement descriptions. Mode returns the mode of the cache (ModePrepare or ModeDescribe) (*T) StatementErrored(sql string, err error) *T : Cache func NewLRU(conn *pgconn.PgConn, mode int, cap int) *LRU
Package-Level Functions (total 4, in which 2 are exported)
New returns the preferred cache implementation for mode and cap. mode is either ModePrepare or ModeDescribe. cap is the maximum size of the cache.
NewLRU creates a new LRU. mode is either ModePrepare or ModeDescribe. cap is the maximum size of the cache.
Package-Level Variables (only one, which is unexported)
Package-Level Constants (total 2, both are exported)
const ModeDescribe = 1 // Cache should prepare the anonymous prepared statement to only fetch the description of the statement.
const ModePrepare = 0 // Cache should prepare named statements.