def METHOD_NAME(self, minage='0'):
    """
    Mark all unsent messages as ignored.
    Input:
        minage  Minimum age required for canceling message, default '0'.
                Format as PostgreSQL interval type, e.g. '1 day 12 hours'.
    Returns number of messages canceled.
    """
    dbconn = self._connect()
    db = dbconn.cursor()
    data = dict(minage=str(minage))
    # Test minage
    if minage != '0':
        sql = "SELECT interval %(minage)s"
        try:
            db.execute(sql, data)
        except nav.db.driver.ProgrammingError:
            self.logger.warning(
                "'autocancel' value (%s) is not valid. "
                + "Check config for errors.",
                minage,
            )
            return 0
        except Exception:
            self.logger.exception(
                "Unknown exception caught in " + "cancel(). Exiting."
            )
            sys.exit(1)
    # Ignore messages
    sql = """UPDATE smsq SET sent = 'I'
        WHERE sent = 'N' AND time < now() - interval %(minage)s"""
    db.execute(sql, data)
    dbconn.commit()
    return db.rowcount