Add local memory caching for fetching counts from sqlite