Cache value of total pages in db