| 532 | |
| 533 | @classmethod |
| 534 | def get_environment_document( |
| 535 | cls, |
| 536 | api_key: str, |
| 537 | ) -> dict[str, typing.Any]: |
| 538 | if ( |
| 539 | settings.CACHE_ENVIRONMENT_DOCUMENT_SECONDS > 0 |
| 540 | or settings.CACHE_ENVIRONMENT_DOCUMENT_MODE |
| 541 | == EnvironmentDocumentCacheMode.PERSISTENT |
| 542 | ): |
| 543 | return cls._get_environment_document_from_cache(api_key) |
| 544 | return cls._get_environment_document_from_db(api_key) |
| 545 | |
| 546 | def get_create_log_message(self, history_instance) -> typing.Optional[str]: # type: ignore[no-untyped-def] |
| 547 | return ENVIRONMENT_CREATED_MESSAGE % self.name # type: ignore[no-any-return] |