DeviceProxy: add option to toggle attribute configuration caching, enabled to speed up writes
Related to #739 (closed)
At the PyTango developers' meeting on 2026-01-15 we decided that we disable Enum labels caching for high-level API. See update below
However, I think, that the use case where this is really needed is very rare, so for almost all users this will only be a disadvantage. So what I propose: we do disabling the attribute info optional, and the default behavior will be the same configuration and enum labels are cached. Even further: since we cache attribute configuration, we can use it at the writing time to call "fast" option (see !929 (merged)). However, to behave like it was before (configuration was auto-fetched, so user could not even notice configuration change) after first try to write, if there was a TypeError I auto-invalidate caches and fetch them again. So in worse case, when user really is wrong with type - it will cost one IO more.
So with this MR I introduce this new logic to read/write attributes with high-level API and 3 new methods to DeviceProxy:
-
DeviceProxy.set_attribute_config_cache(enabled: bool) -> None- to enable/disable caching -
DeviceProxy.is_attribute_config_cache_enabled() -> bool- to get the current settings -
DeviceProxy.invalidate_attribute_config_cache- for one-time invalidation of cache
Update
At the PyTango developers' meeting on 2026-02-05 we decided to use this new mechanism, with caching enabled.