feat: Add an explicit module for caching#432
feat: Add an explicit module for caching#432allenporter merged 4 commits intoPython-roborock:mainfrom
Conversation
A follow up step will support caching network info for the new device manager API, and will use the CLI to do this.
|
|
||
|
|
||
| @dataclass | ||
| class CacheData: |
There was a problem hiding this comment.
I think adding local key would be very helpful here. That theoretically would then have everything you need for local usage
There was a problem hiding this comment.
I believe this is in home_data.devices.local_key?
There was a problem hiding this comment.
Ah yes sorry - was conflating user data in my head - my bad
| async def discover_devices(self) -> list[RoborockDevice]: | ||
| """Discover all devices for the logged-in user.""" | ||
| home_data = await self._home_data_api() | ||
| cache_data = await self._cache.get() |
There was a problem hiding this comment.
I think we should have a way to force an update
There was a problem hiding this comment.
I would like to see if we can address this in the cache implementation e.g. caller can flush their own cache implementation if they don't want caching. If that doesn't work we can add this as an explicit flag here?
The reason why i am thinking about this is because we also may need to flush network info as well sometimes, so it seems nice to invalidate the whole cache and try to refresh.
Add an explicit module for caching that initially is extended to support storing network information and avoiding the need for complext Rborocksession.