Check for all negative values when fetching cachedb counter
(cherry picked from commit 17bc5d970d18a01c4e08a512691264ce3a8c4a80)