hash: add API to query the key count