Factor out a common message cache truncation method.
Factor out a common message cache truncation method.

harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix