package app import "sync" var taxTypeCache = taxTypeCacheType{ obj: map[string]*TaxType{}, } type taxTypeCacheType struct { sync.RWMutex obj map[string]*TaxType } func (m *taxTypeCacheType) get(recordID string) (*TaxType, bool) { m.RLock() defer m.RUnlock() r, ok := m.obj[recordID] return r, ok } func (m *taxTypeCacheType) put(recordID string, itm *TaxType) { m.Lock() defer m.Unlock() m.obj[recordID] = itm }