func (c BasicController) Start(ctx context.Context) {
	c.logger.Info("starting cache controller")
	var logOnce sync.Once
	for i := 0; i < c.options.NumWorkers; i++ {
		go func() {
			for {
				select {
				case <-ctx.Done():
					logOnce.Do(func() {
						c.logger.Info("stopping cache controller")
					})
					return
				case response := <-c.pendingCache:
					c.logger.Debug("caching response")
					if err := c.cacheResponse(response); err != nil {
						c.logger.Error("error caching response", err)
					}
				}
			}
		}()
	}
}
ListenResponses starts listening for responses
package cache
import (
	"bytes"
	"context"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"sync"
	"github.com/gotway/gotway/internal/model"
	"github.com/gotway/gotway/internal/repository"
	"github.com/gotway/gotway/pkg/log"
	"github.com/pquerna/cachecontrol/cacheobject"
)
type Options struct {
	NumWorkers int
	BufferSize int
}
type Params struct {
	Service  string
	TTL      int64
	Statuses []int
	Tags     []string
}
type Controller interface {
	Start(ctx context.Context)
	HandleResponse(r *http.Response, params Params) error
	IsCacheableRequest(r *http.Request) bool
	IsCacheableResponse(r *http.Response, params Params) bool
	GetCache(r *http.Request, service string) (model.Cache, error)
	DeleteCacheByPath(paths []model.CachePath) error
	DeleteCacheByTags(tags []string) error
}
type response struct {
	httpResponse *http.Response
	bodyBytes    []byte
	params       Params
}
type BasicController struct {
	options      Options
	cacheRepo    repository.CacheRepo
	pendingCache chan response
	logger       log.Logger
}