cache height calculation