kit: Index | Files

package cache

import ""


Package Files


type Cache Uses

type Cache struct {
    // contains filtered or unexported fields

Cache collects the most recent set of endpoints from a service discovery system via a subscriber, and makes them available to consumers. Cache is meant to be embedded inside of a concrete subscriber, and can serve Service invocations directly.

func New Uses

func New(factory sd.Factory, logger log.Logger) *Cache

New returns a new, empty endpoint cache.

func (*Cache) Endpoints Uses

func (c *Cache) Endpoints() []endpoint.Endpoint

Endpoints yields the current set of (presumably identical) endpoints, ordered lexicographically by the corresponding instance string.

func (*Cache) Update Uses

func (c *Cache) Update(instances []string)

Update should be invoked by clients with a complete set of current instance strings whenever that set changes. The cache manufactures new endpoints via the factory, closes old endpoints when they disappear, and persists existing endpoints if they survive through an update.

Package cache imports 7 packages (graph) and is imported by 15 packages. Updated 2016-07-19. Refresh now. Tools for package owners.