method count() using internal key cache