MCPcopy Index your code
hub / github.com/CodisLabs/codis / Cleanup

Method Cleanup

pkg/utils/redis/client.go:356–377  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

354}
355
356func (p *Pool) Cleanup() error {
357 p.mu.Lock()
358 defer p.mu.Unlock()
359 if p.closed {
360 return ErrClosedPool
361 }
362
363 for addr, list := range p.pool {
364 for i := list.Len(); i != 0; i-- {
365 c := list.Remove(list.Front()).(*Client)
366 if p.isRecyclable(c) {
367 list.PushBack(c)
368 } else {
369 c.Close()
370 }
371 }
372 if list.Len() == 0 {
373 delete(p.pool, addr)
374 }
375 }
376 return nil
377}
378
379func (p *Pool) GetClient(addr string) (*Client, error) {
380 c, err := p.getClientFromCache(addr)

Callers 1

NewPoolFunction · 0.95

Calls 4

isRecyclableMethod · 0.95
CloseMethod · 0.65
LenMethod · 0.45
PushBackMethod · 0.45

Tested by

no test coverage detected