implemented cache popularity function