func (m *SafeMap) Len() int {
	m.lock.RLock()
	defer m.lock.RUnlock()
	return len(m.m)
}
Len returns map length.
package safemap
import "sync"
type SafeMap struct {
	lock *sync.RWMutex
	m    map[interface{}]interface{}
}
func New() *SafeMap {
	return &SafeMap{
		lock: &sync.RWMutex{},
		m:    make(map[interface{}]interface{}),
	}
}
func (m *SafeMap) Get(key interface{}) (interface{}, bool) {
	m.lock.RLock()
	defer m.lock.RUnlock()
	if val, ok := m.m[key]; ok {
		return val, true
	}
	return nil, false
}
func (m *SafeMap) Set(key, val interface{}) {
	m.lock.Lock()
	defer m.lock.Unlock()
	m.m[key] = val
}
func (m *SafeMap) Has(key interface{}) bool {
	m.lock.RLock()
	defer m.lock.RUnlock()
	_, ok := m.m[key]
	return ok
}
func (m *SafeMap) Delete(key interface{}) bool {
	m.lock.Lock()
	defer m.lock.Unlock()
	_, ok := m.m[key]
	if ok {
		delete(m.m, key)
		return true
	}
	return false
}
func (m *SafeMap) Pop(key interface{}) (interface{}, bool) {
	m.lock.Lock()
	defer m.lock.Unlock()
	v, ok := m.m[key]
	if ok {
		delete(m.m, key)
		return v, true
	}
	return nil, false
}
func (m *SafeMap) Items() map[interface{}]interface{} {
	m.lock.RLock()
	defer m.lock.RUnlock()
	d := make(map[interface{}]interface{}, len(m.m))
	for key, val := range m.m {
		d[key] = val
	}
	return d
}