Add dedicated db cache table (#22650)
Some checks failed
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Github & APT (push) Has been cancelled
Release / Demo (push) Has been cancelled
Release / Hassio Addon (push) Has been cancelled

This commit is contained in:
Michael Geers 2025-08-02 10:04:17 +02:00 • committed by GitHub
parent 31d01bccd3
commit a8c16f2853
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 205 additions and 14 deletions

View file

@ -5,7 +5,7 @@ import (
"fmt"
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/server/db/settings"
"github.com/evcc-io/evcc/server/db/cache"
)
type cached struct {
@ -18,7 +18,7 @@ func cacheKey(typ string, other map[string]any) string {
}
func cachePut(key string, typ api.TariffType, rates api.Rates) error {
return settings.SetJson(key, &cached{
return cache.Put(key, &cached{
Type: typ,
Rates: rates,
})
@ -26,5 +26,5 @@ func cachePut(key string, typ api.TariffType, rates api.Rates) error {
func cacheGet(key string) (*cached, error) {
var res cached
return &res, settings.Json(key, &res)
return &res, cache.Get(key, &res)
}