package cache

import "github.com/go-kit/kit/sd/cache"

Index

Types

type Cache

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

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

New returns a new, empty endpoint cache.

func (*Cache) Endpoints

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

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.

Source Files

cache.go

Version
v0.4.0
Published
Mar 6, 2017
Platform
windows/amd64
Imports
7 packages
Last checked
8 minutes ago

Tools for package owners.