memcache

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 5 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(ctx context.Context, key string) error

Delete to delete data from cache.

func (*Client) Get

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

Get to get data from cache.

func (*Client) Set

func (c *Client) Set(ctx context.Context, key string, data interface{}, ttl ...time.Duration) 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