30 lines
497 B
Go
30 lines
497 B
Go
package app
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"code.tnxs.net/taxnexus/lib/api/geo/geo_models"
|
|
)
|
|
|
|
var countyCache = countyCacheType{
|
|
obj: map[string]*geo_models.County{},
|
|
}
|
|
|
|
type countyCacheType struct {
|
|
sync.RWMutex
|
|
obj map[string]*geo_models.County
|
|
}
|
|
|
|
func (m *countyCacheType) get(key string) (*geo_models.County, bool) {
|
|
m.RLock()
|
|
defer m.RUnlock()
|
|
r, ok := m.obj[key]
|
|
return r, ok
|
|
}
|
|
|
|
func (m *countyCacheType) put(key string, obj *geo_models.County) {
|
|
m.Lock()
|
|
defer m.Unlock()
|
|
m.obj[key] = obj
|
|
}
|