[#265] innerring: Add client cache

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-18 16:30:13 +03:00 committed by Alex Vanin
parent 3d3d058b05
commit 22cffbf529
3 changed files with 36 additions and 0 deletions

24
pkg/innerring/rpc.go Normal file
View file

@ -0,0 +1,24 @@
package innerring
import (
"crypto/ecdsa"
"github.com/nspcc-dev/neofs-api-go/pkg/client"
"github.com/nspcc-dev/neofs-node/pkg/network/cache"
)
type ClientCache struct {
cache *cache.ClientCache
key *ecdsa.PrivateKey
}
func newClientCache(key *ecdsa.PrivateKey) *ClientCache {
return &ClientCache{
cache: cache.NewSDKClientCache(),
key: key,
}
}
func (c *ClientCache) Get(address string, opts ...client.Option) (*client.Client, error) {
return c.cache.Get(c.key, address, opts...)
}