website: golang.org/x/website/internal/memcache Index | Files

package memcache

import "golang.org/x/website/internal/memcache"

Package memcache provides a minimally compatible interface for google.golang.org/appengine/memcache and stores the data in Redis (e.g., via Cloud Memorystore).

Index

Package Files

memcache.go

Variables

var (
    Gob  = Codec{gobMarshal, gobUnmarshal}
    JSON = Codec{json.Marshal, json.Unmarshal}
)
var ErrCacheMiss = errors.New("memcache: cache miss")

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

func New Uses

func New(addr string) *Client

func (*Client) Delete Uses

func (c *Client) Delete(ctx context.Context, key string) error

func (*Client) Get Uses

func (c *Client) Get(ctx context.Context, key string) ([]byte, error)

Get gets the item.

func (*Client) Set Uses

func (c *Client) Set(ctx context.Context, item *Item) error

func (*Client) WithCodec Uses

func (c *Client) WithCodec(codec Codec) *CodecClient

type Codec Uses

type Codec struct {
    Marshal   func(interface{}) ([]byte, error)
    Unmarshal func([]byte, interface{}) error
}

type CodecClient Uses

type CodecClient struct {
    // contains filtered or unexported fields
}

func (*CodecClient) Delete Uses

func (c *CodecClient) Delete(ctx context.Context, key string) error

func (*CodecClient) Get Uses

func (c *CodecClient) Get(ctx context.Context, key string, v interface{}) error

func (*CodecClient) Set Uses

func (c *CodecClient) Set(ctx context.Context, item *Item) error

type Item Uses

type Item struct {
    Key        string
    Value      []byte
    Object     interface{}   // Used with Codec.
    Expiration time.Duration // Read-only.
}

Package memcache imports 7 packages (graph) and is imported by 3 packages. Updated 2020-10-24. Refresh now. Tools for package owners.