remove rcache reference

This commit is contained in:
Asim Aslam 2019-05-31 16:00:44 +01:00
parent f9f893fa85
commit 7a3a7e2eaf

View File

@ -4,22 +4,22 @@ import (
"time" "time"
"github.com/micro/go-micro/registry" "github.com/micro/go-micro/registry"
"github.com/micro/go-rcache" "github.com/micro/go-micro/registry/cache"
) )
type registrySelector struct { type registrySelector struct {
so Options so Options
rc rcache.Cache rc cache.Cache
} }
func (c *registrySelector) newRCache() rcache.Cache { func (c *registrySelector) newCache() cache.Cache {
ropts := []rcache.Option{} ropts := []cache.Option{}
if c.so.Context != nil { if c.so.Context != nil {
if t, ok := c.so.Context.Value("selector_ttl").(time.Duration); ok { if t, ok := c.so.Context.Value("selector_ttl").(time.Duration); ok {
ropts = append(ropts, rcache.WithTTL(t)) ropts = append(ropts, cache.WithTTL(t))
} }
} }
return rcache.New(c.so.Registry, ropts...) return cache.New(c.so.Registry, ropts...)
} }
func (c *registrySelector) Init(opts ...Option) error { func (c *registrySelector) Init(opts ...Option) error {
@ -28,7 +28,7 @@ func (c *registrySelector) Init(opts ...Option) error {
} }
c.rc.Stop() c.rc.Stop()
c.rc = c.newRCache() c.rc = c.newCache()
return nil return nil
} }
@ -100,7 +100,7 @@ func NewSelector(opts ...Option) Selector {
s := &registrySelector{ s := &registrySelector{
so: sopts, so: sopts,
} }
s.rc = s.newRCache() s.rc = s.newCache()
return s return s
} }