Improve platform status

This commit is contained in:
世界
2023-07-16 14:08:45 +08:00
parent 1a29c23263
commit 6e6998dab7
4 changed files with 45 additions and 6 deletions

View File

@@ -7,6 +7,15 @@ type Map[K comparable, V any] struct {
m sync.Map
}
func (m *Map[K, V]) Len() int {
var count int
m.m.Range(func(key, value any) bool {
count++
return true
})
return count
}
func (m *Map[K, V]) Load(key K) (V, bool) {
v, ok := m.m.Load(key)
if !ok {