30 lines
526 B
Go
30 lines
526 B
Go
package app
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
|
)
|
|
|
|
var companyCache = companyCacheType{
|
|
obj: map[string]*crm_models.Company{},
|
|
}
|
|
|
|
type companyCacheType struct {
|
|
sync.RWMutex
|
|
obj map[string]*crm_models.Company
|
|
}
|
|
|
|
func (m *companyCacheType) get(recordID string) (*crm_models.Company, bool) {
|
|
m.RLock()
|
|
defer m.RUnlock()
|
|
r, ok := m.obj[recordID]
|
|
return r, ok
|
|
}
|
|
|
|
func (m *companyCacheType) put(recordID string, itm *crm_models.Company) {
|
|
m.Lock()
|
|
defer m.Unlock()
|
|
m.obj[recordID] = itm
|
|
}
|