memcache

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package memcache is a wrapper of the original "github.com/bradfitz/gomemcache/memcache" library.

Only contains basic get, set, delete, and close methods. Data will be encoded to JSON before saving to cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is memcache client.

func New

func New(address string, expiredTime time.Duration) (*Client, error)

New to create new cache.

func NewFromGoMemCache

func NewFromGoMemCache(client *memcache.Client, expiredTime time.Duration) *Client

NewFromGoMemCache to create new cache from gomemcache.

func (*Client) Close

func (c *Client) Close() error

Close to close cache connection.

func (*Client) Delete

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

Delete to delete data from cache.

func (*Client) Get

func (c *Client) Get(key string, data interface{}) error

Get to get data from cache.

func (*Client) Set

func (c *Client) Set(key string, data interface{}) error

Set to save data to cache.

Jump to

Keyboard shortcuts

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