fear(dao): update dao api
This commit is contained in:
parent
d17f8e243c
commit
21cac4639c
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue