move reg util to own package (#1523)
* move reg util to own package * fix test * fix broken static router
This commit is contained in:
parent
031e2fbfcb
commit
58cd0f660f
5
cache.go
5
cache.go
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/micro/go-micro/v2/logger"
|
||||
"github.com/micro/go-micro/v2/registry"
|
||||
util "github.com/micro/go-micro/v2/util/registry"
|
||||
)
|
||||
|
||||
// Cache is the registry cache interface
|
||||
@ -119,7 +120,7 @@ func (c *cache) get(service string) ([]*registry.Service, error) {
|
||||
// get cache ttl
|
||||
ttl := c.ttls[service]
|
||||
// make a copy
|
||||
cp := registry.Copy(services)
|
||||
cp := util.Copy(services)
|
||||
|
||||
// got services && within ttl so return cache
|
||||
if c.isValid(cp, ttl) {
|
||||
@ -152,7 +153,7 @@ func (c *cache) get(service string) ([]*registry.Service, error) {
|
||||
|
||||
// cache results
|
||||
c.Lock()
|
||||
c.set(service, registry.Copy(services))
|
||||
c.set(service, util.Copy(services))
|
||||
c.Unlock()
|
||||
|
||||
return services, nil
|
||||
|
Loading…
Reference in New Issue
Block a user