GoodWe: add battery mode control over WiFi (AA55/UDP) (#30965)

This commit is contained in:
andig 2026-06-21 22:24:04 +02:00 • committed by GitHub
parent d835cfbde3
commit 0a62ba106b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 273 additions and 2 deletions

View file

@ -69,6 +69,15 @@ func (c *Cache) get(key string) ([]byte, bool) {
return e.payload, true
}
// Clear drops all cached entries. Callers use this after a write to force the
// next read to fetch fresh values instead of serving a stale cached payload.
func (c *Cache) Clear() {
c.mu.Lock()
defer c.mu.Unlock()
clear(c.data)
}
// put inserts or overwrites a payload in the cache.
func (c *Cache) put(key string, payload []byte) {
c.mu.Lock()