Skip to content

Commit

Permalink
remove rcache reference
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed May 31, 2019
1 parent f9f893f commit 7a3a7e2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions selector/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ import (
"time"

"github.com/micro/go-micro/registry"
"github.com/micro/go-rcache"
"github.com/micro/go-micro/registry/cache"
)

type registrySelector struct {
so Options
rc rcache.Cache
rc cache.Cache
}

func (c *registrySelector) newRCache() rcache.Cache {
ropts := []rcache.Option{}
func (c *registrySelector) newCache() cache.Cache {
ropts := []cache.Option{}
if c.so.Context != nil {
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 {
Expand All @@ -28,7 +28,7 @@ func (c *registrySelector) Init(opts ...Option) error {
}

c.rc.Stop()
c.rc = c.newRCache()
c.rc = c.newCache()

return nil
}
Expand Down Expand Up @@ -100,7 +100,7 @@ func NewSelector(opts ...Option) Selector {
s := &registrySelector{
so: sopts,
}
s.rc = s.newRCache()
s.rc = s.newCache()

return s
}

0 comments on commit 7a3a7e2

Please sign in to comment.