couchbase

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package couchbase for session provider

depend on github.com/couchbaselabs/go-couchbasee

go install github.com/couchbaselabs/go-couchbase

Usage: import(

_ "github.com/beego/beego/v2/server/web/session/couchbase"
"github.com/beego/beego/v2/server/web/session"

)

func init() {
	globalSessions, _ = session.NewManager("couchbase", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"http://host:port/, Pool, Bucket"}``)
	go globalSessions.GC()
}

more docs: http://beego.vip/docs/module/session.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	SavePath string `json:"save_path"`
	Pool     string `json:"pool"`
	Bucket   string `json:"bucket"`
	// contains filtered or unexported fields
}

Provider couchabse provided

func (*Provider) SessionAll

func (cp *Provider) SessionAll(context.Context) int

SessionAll return all active session

func (*Provider) SessionDestroy

func (cp *Provider) SessionDestroy(ctx context.Context, sid string) error

SessionDestroy Remove Bucket in this couchbase

func (*Provider) SessionExist

func (cp *Provider) SessionExist(ctx context.Context, sid string) (bool, error)

SessionExist Check couchbase session exist. it checkes sid exist or not.

func (*Provider) SessionGC

func (cp *Provider) SessionGC(context.Context)

SessionGC Recycle

func (*Provider) SessionInit

func (cp *Provider) SessionInit(ctx context.Context, maxlifetime int64, cfg string) error

SessionInit init couchbase session savepath like couchbase server REST/JSON URL For v1.x e.g. http://host:port/, Pool, Bucket For v2.x, you should pass json string. e.g. { "save_path": "http://host:port/", "pool": "mypool", "bucket": "mybucket"}

func (*Provider) SessionRead

func (cp *Provider) SessionRead(ctx context.Context, sid string) (session.Store, error)

SessionRead read couchbase session by sid

func (*Provider) SessionRegenerate

func (cp *Provider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error)

SessionRegenerate remove oldsid and use sid to generate new session

type SessionStore

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

SessionStore store each session

func (*SessionStore) Delete

func (cs *SessionStore) Delete(ctx context.Context, key interface{}) error

Delete value in couchbase session by given key

func (*SessionStore) Flush

func (cs *SessionStore) Flush(context.Context) error

Flush Clean all values in couchbase session

func (*SessionStore) Get

func (cs *SessionStore) Get(ctx context.Context, key interface{}) interface{}

Get value from couchabse session

func (*SessionStore) SessionID

func (cs *SessionStore) SessionID(context.Context) string

SessionID Get couchbase session store id

func (*SessionStore) SessionRelease

func (cs *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)

SessionRelease Write couchbase session with Gob string

func (*SessionStore) Set

func (cs *SessionStore) Set(ctx context.Context, key, value interface{}) error

Set value to couchabse session

Jump to

Keyboard shortcuts

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