Complete move map code to page code in render module
This commit is contained in:
11
go/cache/cache.go
vendored
11
go/cache/cache.go
vendored
@@ -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
2
go/cache/memory.go
vendored
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user