fear(dao): update dao api

This commit is contained in:
bandl 2021-10-19 00:24:36 +08:00
parent d17f8e243c
commit 21cac4639c
2 changed files with 10 additions and 8 deletions

View File

@ -15,10 +15,10 @@ type KeyBaseInterface interface {
type StringXInterface interface {
KeyBaseInterface
Set(val string) (string, UpdateLength)
Set(string) (string, UpdateLength)
Get() string
Add(renewal int32) (string, error)
Reduce(renewal int32) (string, error)
Setbit(offer int32, val bool) UpdateLength
Getbit(offer int32) (bool, error)
Add(int32) (string, error)
Reduce(int32) (string, error)
Setbit(int32, bool) UpdateLength
Getbit(int32) (bool, error)
}

View File

@ -32,9 +32,11 @@ func (d *Dao) Set(key *proto.BaseKey, strVal string) (string, error) {
// 不存在新建
strValue := stringx.NewStringSingle()
result, length := strValue.Set(strVal)
d.lru.Add(key, strValue)
d.lru.UpdateLruSize(length)
result, _ := strValue.Set(strVal)
err := d.lru.Add(key, strValue)
if err != nil {
return "", err
}
return result, nil
}