package dataStruct import "sync" type DMapInterface struct { RWLock sync.Mutex Map *sync.Map } func NewDMapInterface() *DMapInterface { m := &DMapInterface{ Map: new(sync.Map), } return m } func (m *DMapInterface) Add(key interface{}, val interface{}) { m.Map.Store(key, val) } func (m *DMapInterface) Remove(key interface{}) { m.Map.Delete(key) } func (m *DMapInterface) Get(key interface{}) (interface{}, bool) { return m.Map.Load(key) }