Evict removes the host's pool from the cache and closes it.
(host string)
| 149 | |
| 150 | // Evict removes the host's pool from the cache and closes it. |
| 151 | func (c *PoolCache) Evict(host string) { |
| 152 | key := strings.ToLower(strings.TrimSpace(host)) |
| 153 | if key == "" { |
| 154 | return |
| 155 | } |
| 156 | c.mu.Lock() |
| 157 | defer c.mu.Unlock() |
| 158 | if ent, ok := c.entries[key]; ok { |
| 159 | if ent != nil && ent.db != nil { |
| 160 | ent.db.Close() |
| 161 | } |
| 162 | delete(c.entries, key) |
| 163 | } |
| 164 | } |