func newCompressedData() *compressedData {
	var p = sync.Pool{
		New: func() interface{} {
			var b bytes.Buffer
			return &b
		},
	}
	return &compressedData{
		pool: &p,
	}
}
newCompressedData returns a new CompressedData
package backends
import (
	"bytes"
	"compress/zlib"
	"database/sql"
	"fmt"
	"io"
	"math/rand"
	"runtime/debug"
	"strings"
	"sync"
	"time"
	"github.com/flashmob/go-guerrilla/mail"
)
func init() {
	processors["guerrillaredisdb"] = func() Decorator {
		return GuerrillaDbRedis()
	}
}
var queryBatcherId = 0
const GuerrillaDBAndRedisBatchMax = 50
const GuerrillaDBAndRedisBatchTimeout = time.Second * 3
type GuerrillaDBAndRedisBackend struct {
	config    *guerrillaDBAndRedisConfig
	batcherWg sync.WaitGroup
	cache stmtCache
	batcherStoppers []chan bool
}
type stmtCache [GuerrillaDBAndRedisBatchMax]*sql.Stmt
type guerrillaDBAndRedisConfig struct {
	NumberOfWorkers    int    `json:"save_workers_size"`
	Table              string `json:"mail_table"`
	Driver             string `json:"sql_driver"`
	DSN                string `json:"sql_dsn"`
	RedisExpireSeconds int    `json:"redis_expire_seconds"`
	RedisInterface     string `json:"redis_interface"`
	PrimaryHost        string `json:"primary_mail_host"`
	BatchTimeout       int    `json:"redis_sql_batch_timeout,omitempty"`
}
func (g *GuerrillaDBAndRedisBackend) loadConfig(backendConfig BackendConfig) (err error) {
	configType := BaseConfig(&guerrillaDBAndRedisConfig{})
	bcfg, err := Svc.ExtractConfig(backendConfig, configType)
	if err != nil {
		return err
	}
	m := bcfg.(*guerrillaDBAndRedisConfig)
	g.config = m
	return nil
}
func (g *GuerrillaDBAndRedisBackend) getNumberOfWorkers() int {
	return g.config.NumberOfWorkers
}
type redisClient struct {
	isConnected bool
	conn        RedisConn
	time        int
}
type compressedData struct {
	extraHeaders []byte
	data         *bytes.Buffer
	pool         *sync.Pool
}