Skip to content

Latest commit

 

History

History
 
 

gomemcache

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

ppgomemcache

This package instruments the bradfitz/gomemcache package.

Installation

$ go get github.com/pinpoint-apm/pinpoint-go-agent/plugin/gomemcache
import "github.com/pinpoint-apm/pinpoint-go-agent/plugin/gomemcache"

Usage

PkgGoDev

This package instruments the gomemcache calls. Use the NewClient as the memcache.New.

mc := ppgomemcache.NewClient(addr...)

It is necessary to pass the context containing the pinpoint.Tracer to Client using Client.WithContext.

mc.WithContext(pinpoint.NewContext(context.Background(), tracer))
mc.Get("foo")
import (
    "github.com/bradfitz/gomemcache/memcache"
    "github.com/pinpoint-apm/pinpoint-go-agent"
    "github.com/pinpoint-apm/pinpoint-go-agent/plugin/gomemcache"
)

func doMemcache(w http.ResponseWriter, r *http.Request) {
    addr := []string{"localhost:11211"}
    mc := ppgomemcache.NewClient(addr...)
    mc.WithContext(r.Context())

    item, err = mc.Get("foo")
	
    ...
}

Full Example Source