service

package
v0.0.0-...-d66b6fa Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetcher

func Fetcher(key string, redisAddr string) (value interface{}, err error)

Fetcher The function that actually gets info from redis. This is used when the proxy is run for reals. In testing it's replaced by an in memory function reading from a test fixture

Types

type Proxy

type Proxy struct {
	Cache     *cache.Cache
	RedisAddr string
	Port      string
}

Proxy struct to represent the proxy server itself

func NewProxy

func NewProxy(port int, maxEntries int, maxAge int, timeout int, redisAddr string) *Proxy

NewProxy creates, guess what? a new proxy. Uses the default redis fetcher client.

func TestProxy

func TestProxy(port int, maxEntries int, maxAge int, timeout int, redisAddr string, fetcher cache.FetchFunc) *Proxy

TestProxy is just like NewProxy, but allows you to hand in a custom fetch func for testing.

func (*Proxy) Handle

func (p *Proxy) Handle(w http.ResponseWriter, r *http.Request)

Handle is the http handler for all incoming requests.

func (*Proxy) Run

func (p *Proxy) Run() (err error)

Run actually runs the http server for the proxy. It does not detatch from the console

Jump to

Keyboard shortcuts

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