ppgomemcache

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

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

Documentation

Overview

Package ppgomemcache instruments the bradfitz/gomemcache package (https://github.com/bradfitz/gomemcache).

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")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*memcache.Client
	// contains filtered or unexported fields
}

Client wraps memcache.Client.

func NewClient

func NewClient(server ...string) *Client

NewClient wraps memcache.New and returns a memcache.Client wrapper ready to instrument.

func (*Client) Add

func (c *Client) Add(item *memcache.Item) error

func (*Client) CompareAndSwap

func (c *Client) CompareAndSwap(item *memcache.Item) error

func (*Client) Decrement

func (c *Client) Decrement(key string, delta uint64) (uint64, error)

func (*Client) Delete

func (c *Client) Delete(key string) error

func (*Client) DeleteAll

func (c *Client) DeleteAll() error

func (*Client) FlushAll

func (c *Client) FlushAll() error

func (*Client) Get

func (c *Client) Get(key string) (item *memcache.Item, err error)

func (*Client) GetMulti

func (c *Client) GetMulti(keys []string) (map[string]*memcache.Item, error)

func (*Client) Increment

func (c *Client) Increment(key string, delta uint64) (uint64, error)

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Replace

func (c *Client) Replace(item *memcache.Item) error

func (*Client) Set

func (c *Client) Set(item *memcache.Item) error

func (*Client) Touch

func (c *Client) Touch(key string, seconds int32) (err error)

func (*Client) WithContext

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

WithContext sets the context. It is possible to trace only when the given context contains a pinpoint.Tracer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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