groupcache

package
v0.0.0-...-77ed03d Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package groupcache provides a groupcache imageserver.Server implementation.

Index

Constants

View Source
const HTTPPoolContextHeader = "X-Imageserver-Groupcache-Context"

HTTPPoolContextHeader is the header used to store the Context in HTTP requests.

Variables

This section is empty.

Functions

func HTTPPoolContext

func HTTPPoolContext(req *http.Request) groupcache.Context

HTTPPoolContext must be used in groupcache.HTTPPool.Context.

func NewHTTPPoolTransport

func NewHTTPPoolTransport(rt http.RoundTripper) func(groupcache.Context) http.RoundTripper

NewHTTPPoolTransport returns a function that must be used in groupcache.HTTPPool.Transport.

rt is optional, http.DefaultTransport is used by default.

Types

type Context

type Context struct {
	Params imageserver.Params
}

Context is a groupcache.Context implementation used by Getter.

type Getter

type Getter struct {
	Server imageserver.Server
}

Getter is a groupcache.Getter implementation for Server.

func (*Getter) Get

func (gt *Getter) Get(ctx groupcache.Context, key string, dest groupcache.Sink) error

Get implements groupcache.Getter.

type Server

type Server struct {
	Group        *groupcache.Group
	KeyGenerator imageserver_cache.KeyGenerator
}

Server is a groupcache imageserver.Server implementation.

Group MUST use a Getter from this package.

func NewServer

func NewServer(srv imageserver.Server, kg imageserver_cache.KeyGenerator, name string, cacheBytes int64) *Server

NewServer is a helper to create a new groupcache Server.

func (*Server) Get

func (srv *Server) Get(params imageserver.Params) (*imageserver.Image, error)

Get implements imageserver.Server.

Jump to

Keyboard shortcuts

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