memcache

package
v0.0.0-...-ed9fe1d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package memcache provides some utilities for memcache access

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheResponse

func CacheResponse(name lazy.Value, h web.Handler) web.Handler

CacheResponse wraps web.Handler to support cache

func CacheResponseWithExpire

func CacheResponseWithExpire(name lazy.Value, expire time.Duration, h web.Handler) web.Handler

CacheResponseWithExpire wraps web.Handler to support cache

func CachedObjectWithExpiration

func CachedObjectWithExpiration(
	ctx context.Context,
	key string,
	expiration time.Duration,
	dst interface{},
	generator func() (interface{}, error),
	force bool,
) error

CachedObjectWithExpiration execute generator function and store the result with `key` and set the value into dst with expiration.

func Delete

func Delete(ctx context.Context, key string)

Delete deletes the key

func DeleteMulti

func DeleteMulti(ctx context.Context, keys []string) error

DeleteMulti deletes the multiple keys

func Exists

func Exists(ctx context.Context, key string) bool

Exists returns if the key exists

func Get

func Get(ctx context.Context, key string, dst interface{}) error

Get gets the object into dst by `key`

func GetMulti

func GetMulti(ctx context.Context, keys []string, dst interface{}) error

GetMulti gets the values by multiple keys

func IsMemcacheError

func IsMemcacheError(e error) bool

IsMemcacheError returns whether the error is by Memcache

func RegisterCachableHeaderKeys

func RegisterCachableHeaderKeys(keys ...string)

func Set

func Set(ctx context.Context, key string, value interface{}) error

Set sets the value on memcache with key

func SetMulti

func SetMulti(ctx context.Context, keys []string, values interface{}) error

SetMulti is to support multiple keys. `value“ must be []Kind or []*Kind

func SetMultiWithExpire

func SetMultiWithExpire(ctx context.Context, keys []string, values interface{}, expire time.Duration) error

SetMultiWithExpire is like SetMulti and with expiration

func SetWithExpire

func SetWithExpire(ctx context.Context, key string, value interface{}, expire time.Duration) error

SetWithExpire is like Set and with expiration

Types

This section is empty.

Jump to

Keyboard shortcuts

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