func (b *BoundedCachedCompressors) ReleaseZlibWriter(w *zlib.Writer) {
	if len(b.zlibWriters) < b.writersCapacity {
		b.zlibWriters <- w
	}
}
ReleaseZlibWriter accepts a writer (does not have to be one that was cached)
only when the cache has room for it. It will ignore it otherwise.
package restful
import (
	"compress/gzip"
	"compress/zlib"
)
type BoundedCachedCompressors struct {
	gzipWriters     chan *gzip.Writer
	gzipReaders     chan *gzip.Reader
	zlibWriters     chan *zlib.Writer
	writersCapacity int
	readersCapacity int
}
func NewBoundedCachedCompressors(writersCapacity, readersCapacity int) *BoundedCachedCompressors {
	b := &BoundedCachedCompressors{
		gzipWriters:     make(chan *gzip.Writer, writersCapacity),
		gzipReaders:     make(chan *gzip.Reader, readersCapacity),
		zlibWriters:     make(chan *zlib.Writer, writersCapacity),
		writersCapacity: writersCapacity,
		readersCapacity: readersCapacity,
	}
	for ix := 0; ix < writersCapacity; ix++ {
		b.gzipWriters <- newGzipWriter()
		b.zlibWriters <- newZlibWriter()
	}
	for ix := 0; ix < readersCapacity; ix++ {
		b.gzipReaders <- newGzipReader()
	}
	return b
}
func (b *BoundedCachedCompressors) AcquireGzipWriter() *gzip.Writer {
	var writer *gzip.Writer
	select {
	case writer, _ = <-b.gzipWriters:
	default:
		writer = newGzipWriter()
	}
	return writer
}
func (b *BoundedCachedCompressors) ReleaseGzipWriter(w *gzip.Writer) {
	if len(b.gzipWriters) < b.writersCapacity {
		b.gzipWriters <- w
	}
}
func (b *BoundedCachedCompressors) AcquireGzipReader() *gzip.Reader {
	var reader *gzip.Reader
	select {
	case reader, _ = <-b.gzipReaders:
	default:
		reader = newGzipReader()
	}
	return reader
}
func (b *BoundedCachedCompressors) ReleaseGzipReader(r *gzip.Reader) {
	if len(b.gzipReaders) < b.readersCapacity {
		b.gzipReaders <- r
	}
}
func (b *BoundedCachedCompressors) AcquireZlibWriter() *zlib.Writer {
	var writer *zlib.Writer
	select {
	case writer, _ = <-b.zlibWriters:
	default:
		writer = newZlibWriter()
	}
	return writer
}