API¶
Use these tools if the automatic behaviour of django-cachalot is not enough. See Raw SQL queries.
-
cachalot.api.invalidate_tables(tables, cache_alias=None, db_alias=None)[source]¶ Clears what was cached by django-cachalot implying one or more SQL tables from
tables.If
cache_aliasis specified, it only clears the SQL queries stored on this cache, otherwise queries from all caches are cleared.If
db_aliasis specified, it only clears the SQL queries executed on this database, otherwise queries from all databases are cleared.Parameters: - tables (iterable of strings) – SQL tables names
- cache_alias (string or NoneType) – Alias from the Django
CACHESsetting - db_alias (string or NoneType) – Alias from the Django
DATABASESsetting
Returns: Nothing
Return type: NoneType
-
cachalot.api.invalidate_models(models, cache_alias=None, db_alias=None)[source]¶ Shortcut for
invalidate_tableswhere you can specify Django models instead of SQL table names.Parameters: - models (iterable of
django.db.models.Modelsubclasses) – Django models - cache_alias (string or NoneType) – Alias from the Django
CACHESsetting - db_alias (string or NoneType) – Alias from the Django
DATABASESsetting
Returns: Nothing
Return type: NoneType
- models (iterable of
-
cachalot.api.invalidate_all(cache_alias=None, db_alias=None)[source]¶ Clears everything that was cached by django-cachalot.
If
cache_aliasis specified, it only clears the SQL queries stored on this cache, otherwise queries from all caches are cleared.If
db_aliasis specified, it only clears the SQL queries executed on this database, otherwise queries from all databases are cleared.Parameters: - cache_alias (string or NoneType) – Alias from the Django
CACHESsetting - db_alias – Alias from the Django
DATABASESsetting
Returns: Nothing
Return type: NoneType
- cache_alias (string or NoneType) – Alias from the Django