mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +02:00
app/abi/manager.go: Adding SetAbi()
This commit is contained in:
parent
2f215d121d
commit
80448ddd32
1 changed files with 5 additions and 1 deletions
|
|
@ -31,6 +31,10 @@ func NewAbiManager(rdb *redis.Client, api *eos.API, id string) *AbiManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mgr *AbiManager) SetAbi(account eos.AccountName, abi *eos.ABI) error {
|
||||||
|
return mgr.cache.Set(string(account), abi, time.Hour)
|
||||||
|
}
|
||||||
|
|
||||||
func (mgr *AbiManager) GetAbi(account eos.AccountName) (*eos.ABI, error) {
|
func (mgr *AbiManager) GetAbi(account eos.AccountName) (*eos.ABI, error) {
|
||||||
key := string(account)
|
key := string(account)
|
||||||
|
|
||||||
|
|
@ -42,7 +46,7 @@ func (mgr *AbiManager) GetAbi(account eos.AccountName) (*eos.ABI, error) {
|
||||||
}
|
}
|
||||||
abi = &resp.ABI
|
abi = &resp.ABI
|
||||||
|
|
||||||
err = mgr.cache.Set(key, abi, time.Hour)
|
err = mgr.SetAbi(account, abi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cache: %s", err)
|
return nil, fmt.Errorf("cache: %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue