Added cache hit counter and logging of exceptions