<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def after_insert(mapper, connection, target):
 """Update reply order cache and send record-after-update signal."""

    record_after_update.send(CmtRECORDCOMMENT, recid=target.id_bibrec)

    from .api import get_reply_order_cache_data
    if target.in_reply_to_id_cmtRECORDCOMMENT > 0:
        parent = CmtRECORDCOMMENT.query.get(
            target.in_reply_to_id_cmtRECORDCOMMENT)
        if parent:
            trans = connection.begin()
            parent_reply_order = parent.reply_order_cached_data \
                if parent.reply_order_cached_data else ''
            parent_reply_order += get_reply_order_cache_data(target.id)
            connection.execute(
                db.update(CmtRECORDCOMMENT.__table__).
                where(CmtRECORDCOMMENT.id == parent.id).
                values(reply_order_cached_data=parent_reply_order))
            trans.commit()