forked from Ivasoft/traefik
Dynamic Configuration Refactoring
This commit is contained in:
committed by
Traefiker Bot
parent
d3ae88f108
commit
a09dfa3ce1
27
server/service/bufferpool.go
Normal file
27
server/service/bufferpool.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package service
|
||||
|
||||
import "sync"
|
||||
|
||||
const bufferPoolSize = 32 * 1024
|
||||
|
||||
func newBufferPool() *bufferPool {
|
||||
return &bufferPool{
|
||||
pool: sync.Pool{
|
||||
New: func() interface{} {
|
||||
return make([]byte, bufferPoolSize)
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type bufferPool struct {
|
||||
pool sync.Pool
|
||||
}
|
||||
|
||||
func (b *bufferPool) Get() []byte {
|
||||
return b.pool.Get().([]byte)
|
||||
}
|
||||
|
||||
func (b *bufferPool) Put(bytes []byte) {
|
||||
b.pool.Put(bytes)
|
||||
}
|
||||
Reference in New Issue
Block a user