store

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

File is a degrade file service.

func NewFile

func NewFile(fc *FileConfig) *File

NewFile new a file degrade service.

func (*File) Get

func (fs *File) Get(ctx context.Context, key string) (bs []byte, err error)

Get get result from file by locaiton+params.

func (*File) Set

func (fs *File) Set(ctx context.Context, key string, bs []byte, _ int32) (err error)

Set save the result of location to file. expire is not implemented in file storage.

type FileConfig

type FileConfig struct {
	RootDir string
}

FileConfig config of File.

type Memcache

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

Memcache represents the cache with memcached persistence

func NewMemcache

func NewMemcache(c *memcache.Config) *Memcache

NewMemcache new a memcache store.

func (*Memcache) Get

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

Get get result from mc by locaiton+params.

func (*Memcache) Set

func (ms *Memcache) Set(ctx context.Context, key string, value []byte, expire int32) (err error)

Set save the result to memcache store.

type Store

type Store interface {
	// Get retrieves an item from the cache. Returns the item or nil, and a bool indicating
	// whether the key was found.
	Get(ctx context.Context, key string) ([]byte, error)

	// Set sets an item to the cache, replacing any existing item.
	Set(ctx context.Context, key string, value []byte, expire int32) error
}

Store is the interface of a cache backend

Jump to

Keyboard shortcuts

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