Manage cache for stats with query