Factor out a common message cache truncation method.