mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-19 19:47:49 +01:00
Store: New Count() function to return count of all records stored.
This commit is contained in:
@@ -71,3 +71,10 @@ func (ms *MemoryStore) Delete(key []byte) {
|
||||
delete(ms.data, string(key))
|
||||
ms.mutex.Unlock()
|
||||
}
|
||||
|
||||
// Count returns the count of records stored.
|
||||
func (ms *MemoryStore) Count() uint64 {
|
||||
ms.mutex.Lock()
|
||||
defer ms.mutex.Unlock()
|
||||
return uint64(len(ms.data))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user