package stmtcache

import (
	

	
)

// UnlimitedCache implements Cache with no capacity limit.
type UnlimitedCache struct {
	m            map[string]*pgconn.StatementDescription
	invalidStmts []*pgconn.StatementDescription
}

// NewUnlimitedCache creates a new UnlimitedCache.
func () *UnlimitedCache {
	return &UnlimitedCache{
		m: make(map[string]*pgconn.StatementDescription),
	}
}

// Get returns the statement description for sql. Returns nil if not found.
func ( *UnlimitedCache) ( string) *pgconn.StatementDescription {
	return .m[]
}

// Put stores sd in the cache. Put panics if sd.SQL is "". Put does nothing if sd.SQL already exists in the cache.
func ( *UnlimitedCache) ( *pgconn.StatementDescription) {
	if .SQL == "" {
		panic("cannot store statement description with empty SQL")
	}

	if ,  := .m[.SQL];  {
		return
	}

	.m[.SQL] = 
}

// Invalidate invalidates statement description identified by sql. Does nothing if not found.
func ( *UnlimitedCache) ( string) {
	if ,  := .m[];  {
		delete(.m, )
		.invalidStmts = append(.invalidStmts, )
	}
}

// InvalidateAll invalidates all statement descriptions.
func ( *UnlimitedCache) () {
	for ,  := range .m {
		.invalidStmts = append(.invalidStmts, )
	}

	.m = make(map[string]*pgconn.StatementDescription)
}

func ( *UnlimitedCache) () []*pgconn.StatementDescription {
	 := .invalidStmts
	.invalidStmts = nil
	return 
}

// Len returns the number of cached prepared statement descriptions.
func ( *UnlimitedCache) () int {
	return len(.m)
}

// Cap returns the maximum number of cached prepared statement descriptions.
func ( *UnlimitedCache) () int {
	return math.MaxInt
}