def invalidate(*tables_or_models, **kwargs):
    """
    Clears what was cached by django-cachalot implying one or more SQL tables
    or models from ``tables_or_models``.
    If ``tables_or_models`` is not specified, all tables found in the database
    (including those outside Django) are invalidated.

    If ``cache_alias`` is specified, it only clears the SQL queries stored
    on this cache, otherwise queries from all caches are cleared.

    If ``db_alias`` is specified, it only clears the SQL queries executed
    on this database, otherwise queries from all databases are cleared.

    :arg tables_or_models: SQL tables names or models (or combination of both)
    :type tables_or_models: tuple of strings or models
    :arg cache_alias: Alias from the Django ``CACHES`` setting
    :type cache_alias: string or NoneType
    :arg db_alias: Alias from the Django ``DATABASES`` setting
    :type db_alias: string or NoneType
    :returns: Nothing
    :rtype: NoneType
    """
    # TODO: Replace with positional arguments when we drop Python 2 support.
    cache_alias = kwargs.pop('cache_alias', None)
    db_alias = kwargs.pop('db_alias', None)
    for k in kwargs:
        raise TypeError(
            "invalidate() got an unexpected keyword argument '%s'" % k)

    invalidated = set()
    for cache_alias, db_alias, tables in _cache_db_tables_iterator(
            _get_tables(tables_or_models), cache_alias, db_alias):
        _invalidate_tables(
            cachalot_caches.get_cache(cache_alias, db_alias), db_alias, tables)
        invalidated.update(tables)

    for table in invalidated:
        post_invalidation.send(table, db_alias=db_alias)
dataset/ETHPy150Open BertrandBordage/django-cachalot/cachalot/api.py/invalidate/original