Complete move map code to page code in render module

This commit is contained in:
lash
2023-04-10 15:26:18 +01:00
parent 765bc2a269
commit 0831a4ea53
11 changed files with 61 additions and 36 deletions

11
go/cache/cache.go vendored
View File

@@ -113,12 +113,13 @@ func(ca *Cache) Update(key string, value string) error {
return nil
}
// Get returns the full key-value mapping for all mapped keys at the current cache level.
func(ca *Cache) Get() (map[string]string, error) {
if len(ca.Cache) == 0 {
return nil, fmt.Errorf("get at top frame")
func(ca *Cache) Get(key string) (string, error) {
i := ca.frameOf(key)
r, ok := ca.Cache[i][key]
if !ok {
return "", fmt.Errorf("unknown key: %s", key)
}
return ca.Cache[len(ca.Cache)-1], nil
return r, nil
}
// Reset flushes all state contents below the top level.

2
go/cache/memory.go vendored
View File

@@ -4,7 +4,7 @@ type Memory interface {
Add(key string, val string, sizeLimit uint16) error
Update(key string, val string) error
ReservedSize(key string) (uint16, error)
Get() (map[string]string, error)
Get(key string) (string, error)
Push() error
Pop() error
Reset()