From 3758fb9de26cc7fb351e6296825dce93abff0eba Mon Sep 17 00:00:00 2001 From: xiezhaodong Date: Thu, 24 Apr 2025 16:36:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E4=BD=BF=E7=94=A8lru?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prepare_stmt.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prepare_stmt.go b/prepare_stmt.go index bb81e684..1d922ede 100644 --- a/prepare_stmt.go +++ b/prepare_stmt.go @@ -88,7 +88,7 @@ func (db *PreparedStmtDB) Close() { return } - for _, stmt := range db.Stmts.allMap() { + for _, stmt := range db.Stmts.AllMap() { go func(s *Stmt) { // make sure the stmt must finish preparation first <-s.prepared @@ -107,7 +107,7 @@ func (sdb *PreparedStmtDB) Reset() { if sdb.Stmts == nil { return } - for _, stmt := range sdb.Stmts.allMap() { + for _, stmt := range sdb.Stmts.AllMap() { go func(s *Stmt) { // make sure the stmt must finish preparation first <-s.prepared @@ -330,7 +330,7 @@ type StmtStore interface { get(key string) (*Stmt, bool) set(key string, value *Stmt) delete(key string) - allMap() map[string]*Stmt + AllMap() map[string]*Stmt } /* @@ -386,7 +386,7 @@ func (s *LruStmtStore) newLru(size int, ttl time.Duration) { s.lru = lru.NewLRU[string, *Stmt](size, onEvicted, ttl) } -func (s *LruStmtStore) allMap() map[string]*Stmt { +func (s *LruStmtStore) AllMap() map[string]*Stmt { return s.lru.KeyValues() } func (s *LruStmtStore) get(key string) (*Stmt, bool) {