use cache buffer size instead of line counter for flushing output file