支持lru淘汰preparestmt cache
This commit is contained in:
parent
3ae5fdee0c
commit
618e8c1aa6
@ -344,10 +344,17 @@ func (s *LruStmtStore) NewLru(size int, ttl time.Duration) {
|
|||||||
onEvicted := func(k string, v *Stmt) {
|
onEvicted := func(k string, v *Stmt) {
|
||||||
if v != nil {
|
if v != nil {
|
||||||
go func() {
|
go func() {
|
||||||
err := v.Close()
|
defer func() {
|
||||||
if err != nil {
|
if r := recover(); r != nil {
|
||||||
//
|
fmt.Print("close stmt err panic ")
|
||||||
fmt.Print("close stmt err: ", err.Error())
|
}
|
||||||
|
}()
|
||||||
|
if v != nil {
|
||||||
|
err := v.Close()
|
||||||
|
if err != nil {
|
||||||
|
//
|
||||||
|
fmt.Print("close stmt err: ", err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user