memcache

package
v0.0.0-...-eb400f0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const ProviderName = "memcache"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// memcache server list
	ServerList []string

	// MaxIdleConns specifies the maximum number of idle connections that will
	// be maintained per address. If less than one, DefaultMaxIdleConns will be
	// used.
	//
	// Consider your expected traffic rates and latency carefully. This should
	// be set to a number higher than your peak parallel requests.
	MaxIdle int

	// sessionId as memcache key prefix
	KeyPrefix string

	// session value serialize func
	SerializeFunc func(data map[string]interface{}) ([]byte, error)

	// session value unSerialize func
	UnSerializeFunc func(data []byte) (map[string]interface{}, error)
}

func (*Config) Name

func (mc *Config) Name() string

type Provider

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

func NewProvider

func NewProvider() *Provider

new memcache provider

func (*Provider) Count

func (mcp *Provider) Count() int

session values count

func (*Provider) Destroy

func (mcp *Provider) Destroy(sessionId string) error

destroy session by sessionId

func (*Provider) GC

func (mcp *Provider) GC()

session memcache provider not need garbage collection

func (*Provider) Init

func (mcp *Provider) Init(lifeTime int64, memCacheConfig fasthttpsession.ProviderConfig) error

init provider config

func (*Provider) NeedGC

func (mcp *Provider) NeedGC() bool

not need gc

func (*Provider) ReadStore

func (mcp *Provider) ReadStore(sessionId string) (fasthttpsession.SessionStore, error)

read session store by session id

func (*Provider) Regenerate

func (mcp *Provider) Regenerate(oldSessionId string, sessionId string) (fasthttpsession.SessionStore, error)

regenerate session

type Store

type Store struct {
	fasthttpsession.Store
}

func NewMemCacheStore

func NewMemCacheStore(sessionId string) *Store

new default memCache store

func NewMemCacheStoreData

func NewMemCacheStoreData(sessionId string, data map[string]interface{}) *Store

new memCache store data

func (*Store) Save

func (mcs *Store) Save(ctx *fasthttp.RequestCtx) error

save store

Jump to

Keyboard shortcuts

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