MCPcopy
hub / github.com/micro/go-micro / New

Function New

registry/cache/cache.go:562–585  ·  view source on GitHub ↗

New returns a new cache.

(r registry.Registry, opts ...Option)

Source from the content-addressed store, hash-verified

560
561// New returns a new cache.
562func New(r registry.Registry, opts ...Option) Cache {
563
564 options := Options{
565 TTL: DefaultTTL,
566 MinimumRetryInterval: DefaultMinimumRetryInterval,
567 Logger: log.DefaultLogger,
568 }
569
570 for _, o := range opts {
571 o(&options)
572 }
573
574 return &cache{
575 Registry: r,
576 opts: options,
577 watched: make(map[string]bool),
578 watchedRunning: make(map[string]bool),
579 cache: make(map[string][]*registry.Service),
580 ttls: make(map[string]time.Time),
581 nttls: make(map[string]map[string]time.Time),
582 lastRefreshAttempt: make(map[string]time.Time),
583 exit: make(chan bool),
584 }
585}

Calls

no outgoing calls