cache the length