Clear all internal caches, for methods that alter the app registry. This is mostly used in tests.
(self)
| 368 | self.clear_cache() |
| 369 | |
| 370 | def clear_cache(self): |
| 371 | """ |
| 372 | Clear all internal caches, for methods that alter the app registry. |
| 373 | |
| 374 | This is mostly used in tests. |
| 375 | """ |
| 376 | self.get_swappable_settings_name.cache_clear() |
| 377 | # Call expire cache on each model. This will purge |
| 378 | # the relation tree and the fields cache. |
| 379 | self.get_models.cache_clear() |
| 380 | if self.ready: |
| 381 | # Circumvent self.get_models() to prevent that the cache is |
| 382 | # refilled. This particularly prevents that an empty value is |
| 383 | # cached while cloning. |
| 384 | for app_config in self.app_configs.values(): |
| 385 | for model in app_config.get_models(include_auto_created=True): |
| 386 | model._meta._expire_cache() |
| 387 | |
| 388 | def lazy_model_operation(self, function, *model_keys): |
| 389 | """ |