elasticache

package module
v0.0.0-...-84f3c7f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 9 Imported by: 0

README

go-elasticache

This is a fork of Integralist/go-elasticache with a few changes and additions:

  • Watcher support for detecting and applying server changes.
  • Removed logging and reliance on environment variables.
  • Remove unnecessary Node and Item types.
  • Replaced glide with dep as dependency manager.
  • Moved package to go-elasticache instead of go-elasticache/elasticache.

Auto Detect Cluster Changes

You can use the Watch method to detect changes in cluster configuration. The client is updated automatically when changes are detected.

// Make sure the endpoint has ".cfg" in it!
client, _ := elasticache.New("mycluster.fnjyzo.cfg.use1.cache.amazonaws.com")

ctx := context.WithCancel(context.Background())
defer cancel() // Call cancel when you are done with the memcache client

go client.Watch(ctx)

See Elasticache Auto Discovery docs for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*memcache.Client
	// Custom ServerList so we can replace endpoints automatically at runtime
	ServerList *memcache.ServerList
	// Elasticache config endpoint
	Endpoint string
}

Client is an Elasticache-aware memcache client

func New

func New(endpoint string) (*Client, error)

New takes an Elasticache configuration endpoint and returns an instance of the memcache client.

func (*Client) Watch

func (c *Client) Watch(ctx context.Context)

Watch polls the Elasticache endpoint every 60 seconds to update cluster endpoints. It can be stopped by calling ctx.Done()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL