package app import ( "sync" "code.tnxs.net/taxnexus/lib/api/ledger/ledger_models" ) var accountingRulesetCache = accountingRulesetCacheType{ obj: map[string]map[string]*ledger_models.AccountingRuleset{}, } type accountingRulesetCacheType struct { sync.RWMutex obj map[string]map[string]*ledger_models.AccountingRuleset } func (m *accountingRulesetCacheType) get(accountID string) (map[string]*ledger_models.AccountingRuleset, bool) { m.RLock() defer m.RUnlock() r, ok := m.obj[accountID] return r, ok } func (m *accountingRulesetCacheType) put(accountID string, rules map[string]*ledger_models.AccountingRuleset) { m.Lock() defer m.Unlock() m.obj[accountID] = rules }