1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-16 03:43:34 +00:00

Adds Count method to BeeMap struct

This adds a Count() method to BeeMap struct that returns the number of
items within the safe map.
This commit is contained in:
Faissal Elamraoui 2016-12-28 12:36:39 +01:00
parent 99093693c8
commit d736d0ca87

View File

@ -84,3 +84,10 @@ func (m *BeeMap) Items() map[interface{}]interface{} {
}
return r
}
// Count returns the number of items within the map.
func (m *BeeMap) Count() int {
m.lock.RLock()
defer m.lock.RUnlock()
return len(m.bm)
}