memcache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package memcache provides a cache.Storage compatible client for the memcached cache server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memcache

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

Memcache is a memcache client. It is safe for unlocked use by multiple concurrent goroutines.

func New

func New(ss []string, option Option) *Memcache

New returns a memcache client using the provided servers and options.

func (*Memcache) Name

func (c *Memcache) Name() string

Name returns cache storage identifier.

func (*Memcache) Read

func (c *Memcache) Read(key string) ([]byte, error)

Read reads the item for given key. It's automatically decode item.Value depending on the client option.

func (*Memcache) ReadMulti

func (c *Memcache) ReadMulti(keys []string) (map[string][]byte, error)

ReadMulti is a batch version of Read. The returned map have exact length as provided keys. For cache miss, an empty byte will be returned.

func (*Memcache) Write

func (c *Memcache) Write(key string, value []byte, expiration time.Duration) error

Write writes the item for given key.

type Option

type Option struct {
	Compress bool
	Timeout  time.Duration
}

Option represents configurable configuration for memcache client.

Jump to

Keyboard shortcuts

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