func (store *AllocStore) GetAllocJob(location string, jobId string) *models.JobData {
	store.RLock()
	defer store.RUnlock()
	if jobsAlloc, ret := store.tableData[location]; ret {
		for _, jobData := range jobsAlloc.Jobs {
			if jobData.JobId == jobId {
				return jobData
			}
		}
	}
	return nil
}
GetAllocJob is exported
return location alloc's jobdata.
package cache
import "github.com/cloudtask/common/models"
import (
	"bytes"
	"sync"
)
type AllocEvent int
const (
	ALLOC_CREATED_EVENT AllocEvent = iota + 1
	ALLOC_CHANGED_EVENT
	ALLOC_REMOVED_EVENT
)
func (event AllocEvent) String() string {
	switch event {
	case ALLOC_CREATED_EVENT:
		return "ALLOC_CREATED_EVENT"
	case ALLOC_CHANGED_EVENT:
		return "ALLOC_CHANGED_EVENT"
	case ALLOC_REMOVED_EVENT:
		return "ALLOC_REMOVED_EVENT"
	}
	return ""
}
type AllocCacheEventHandlerFunc func(event AllocEvent, location string, data []byte, err error)
type AllocStore struct {
	sync.RWMutex
	allocPool *sync.Pool
	tableData models.AllocMapper
	callback  AllocCacheEventHandlerFunc
}
func NewAllocStore(callback AllocCacheEventHandlerFunc) *AllocStore {
	allocPool := &sync.Pool{
		New: func() interface{} {  
			return bytes.NewBuffer(make([]byte, 0, 128<<10))
		},
	}
	return &AllocStore{
		allocPool: allocPool,
		tableData: make(models.AllocMapper, 0),
		callback:  callback,
	}
}
func (store *AllocStore) ClearAlloc() {
	store.Lock()
	defer store.Unlock()
	for location := range store.tableData {
		store.tableData[location].Jobs = []*models.JobData{}
		delete(store.tableData, location)
	}
}
func (store *AllocStore) GetAlloc(location string) *models.JobsAlloc {
	store.RLock()
	defer store.RUnlock()
	if jobsAlloc, ret := store.tableData[location]; ret {
		return jobsAlloc
	}
	return nil
}
func (store *AllocStore) HasAlloc(location string) bool {
	store.RLock()
	defer store.RUnlock()
	_, ret := store.tableData[location]
	return ret
}
func (store *AllocStore) HasAllocJobId(location string, jobId string) bool {
	store.RLock()
	defer store.RUnlock()
	jobsAlloc, ret := store.tableData[location]
	if !ret {
		return false
	}
	for _, jobData := range jobsAlloc.Jobs {
		if jobData.JobId == jobId {
			return true
		}
	}
	return false
}
func (store *AllocStore) GetAllocJobIds(location string, key string) []string {
	store.RLock()
	defer store.RUnlock()
	jobIds := []string{}
	if jobsAlloc, ret := store.tableData[location]; ret {
		for _, jobData := range jobsAlloc.Jobs {
			if jobData.Key == key {
				jobIds = append(jobIds, jobData.JobId)
			}
		}
	}
	return jobIds
}
func (store *AllocStore) SetAllocJobsKey(location string, jobs map[string]string) {
	var (
		ret       bool
		jobsAlloc *models.JobsAlloc
	)
	store.Lock()
	defer store.Unlock()
	if jobsAlloc, ret = store.tableData[location]; !ret {
		return
	}
	for jobid, key := range jobs {
		for _, jobData := range jobsAlloc.Jobs {
			if jobData.JobId == jobid {
				jobData.Key = key
				break
			}
		}
	}
	jobsAlloc.Version = jobsAlloc.Version + 1
	data, err := models.JobsAllocEnCode(store.allocPool, jobsAlloc)
	store.callback(ALLOC_CHANGED_EVENT, location, data, err)
}