Refreshes the cache keys associated with the plugin configuration. Args: user (User): The user for whom the cache keys are refreshed (optional).
(self, user: User = None)
| 1545 | )[0] |
| 1546 | |
| 1547 | def refresh_cache_keys(self, user: User = None): |
| 1548 | """ |
| 1549 | Refreshes the cache keys associated with the plugin configuration. |
| 1550 | |
| 1551 | Args: |
| 1552 | user (User): The user for whom the cache keys are refreshed (optional). |
| 1553 | """ |
| 1554 | from api_app.serializers.plugin import PythonConfigListSerializer |
| 1555 | |
| 1556 | base_key = f"{self.__class__.__name__}_{self.name}_{user.username if user else ''}" |
| 1557 | for key in cache.get_where(f"serializer_{base_key}").keys(): |
| 1558 | logger.debug(f"Deleting cache key {key}") |
| 1559 | cache.delete(key) |
| 1560 | if user: |
| 1561 | PythonConfigListSerializer(child=self.serializer_class()).to_representation_single_plugin( |
| 1562 | self, user |
| 1563 | ) |
| 1564 | else: |
| 1565 | for generic_user in User.objects.exclude(email=""): |
| 1566 | PythonConfigListSerializer(child=self.serializer_class()).to_representation_single_plugin( |
| 1567 | self, generic_user |
| 1568 | ) |
| 1569 | |
| 1570 | @classproperty |
| 1571 | def serializer_class(cls) -> Type["PythonConfigSerializer"]: |
nothing calls this directly
no test coverage detected