func (cacheRepository *CacheRepository) Clear() {
	cacheRepository.nodeStore.ClearWorkers()
	cacheRepository.allocStore.ClearAlloc()
	cacheRepository.localStorage.Clear()
}
Clear is expotred
package cache
import _ "github.com/cloudtask/cloudtask-center/cache/driver/mongo"
import _ "github.com/cloudtask/cloudtask-center/cache/driver/ngcloud"
import "github.com/cloudtask/cloudtask-center/cache/driver"
import "github.com/cloudtask/cloudtask-center/cache/driver/types"
import "github.com/cloudtask/common/models"
import "github.com/cloudtask/libtools/gounits/httpx"
import "github.com/cloudtask/libtools/gounits/logger"
import "github.com/cloudtask/libtools/gzkwrapper"
import (
	"bytes"
	"encoding/json"
	"net"
	"net/http"
	"strings"
	"time"
)
type ReadLocationAllocFunc func(location string) []byte
type ProcLocationAllocFunc func(location string, addServers []*models.Server, delServers []*models.Server)
type CacheConfigs struct {
	LRUSize                 int
	StorageBackend          types.Backend
	StorageDriverParameters types.Parameters
	AllocHandlerFunc        AllocCacheEventHandlerFunc
	NodeHandlerFunc         NodeCacheEventHandlerFunc
	ReadLocationAllocFunc   ReadLocationAllocFunc
	ProcLocationAllocFunc   ProcLocationAllocFunc
}
type CacheRepository struct {
	nodeStore             *NodeStore
	allocStore            *AllocStore
	localStorage          *LocalStorage
	client                *httpx.HttpClient
	storageDriver         driver.StorageDriver
	readLocationAllocFunc ReadLocationAllocFunc
	procLocationAllocFunc ProcLocationAllocFunc
}
func NewCacheRepository(configs *CacheConfigs) (*CacheRepository, error) {
	storageDriver, err := driver.NewDriver(configs.StorageBackend, configs.StorageDriverParameters)
	if err != nil {
		return nil, err
	}
	if configs.LRUSize <= 0 {
		configs.LRUSize = DefaultLRUSize
	}
	client := httpx.NewClient().
		SetTransport(&http.Transport{
			Proxy: http.ProxyFromEnvironment,
			DialContext: (&net.Dialer{
				Timeout:   30 * time.Second,
				KeepAlive: 60 * time.Second,
			}).DialContext,
			DisableKeepAlives:     false,
			MaxIdleConns:          25,
			MaxIdleConnsPerHost:   25,
			IdleConnTimeout:       90 * time.Second,
			TLSHandshakeTimeout:   http.DefaultTransport.(*http.Transport).TLSHandshakeTimeout,
			ExpectContinueTimeout: http.DefaultTransport.(*http.Transport).ExpectContinueTimeout,
		})
	return &CacheRepository{
		nodeStore:             NewNodeStore(configs.NodeHandlerFunc),
		allocStore:            NewAllocStore(configs.AllocHandlerFunc),
		localStorage:          NewLocalStorage(configs.LRUSize),
		client:                client,
		storageDriver:         storageDriver,
		readLocationAllocFunc: configs.ReadLocationAllocFunc,
		procLocationAllocFunc: configs.ProcLocationAllocFunc,
	}, nil
}
func (cacheRepository *CacheRepository) Open() error {
	return cacheRepository.storageDriver.Open()
}
func (cacheRepository *CacheRepository) Close() {
	cacheRepository.storageDriver.Close()
}
func (cacheRepository *CacheRepository) SetStorageDriverConfigParameters(parameters types.Parameters) {
	cacheRepository.storageDriver.SetConfigParameters(parameters)
}