etcdstore

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 8 Imported by: 1

README

etcdstore

A Gorilla Sessions Store implementation backed by ETCD

Documentation

Overview

Package etcdstore is a session store backend for gorilla/sessions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdStore

type EtcdStore struct {
	Client  *clientv3.Client
	Context context.Context
	Codecs  []securecookie.Codec
	Options *sessions.Options
	// contains filtered or unexported fields
}

EtcdStore stores sessions in a etcd backend.

func NewEtcdStore

func NewEtcdStore(config clientv3.Config, ctx context.Context, prefix string, keyPairs ...[]byte) (*EtcdStore, error)

func (*EtcdStore) Close

func (s *EtcdStore) Close() error

Close the etcd client

func (*EtcdStore) Get

func (s *EtcdStore) Get(r *http.Request, name string) (*sessions.Session, error)

Get returns a session for the given name after adding it to the registry.

See gorilla/sessions CookieStore.Get().

func (*EtcdStore) MaxAge

func (s *EtcdStore) MaxAge(age int)

MaxAge sets the maximum age for the store and the underlying cookie implementation. Individual sessions can be deleted by setting Options.MaxAge = -1 for that session.

func (*EtcdStore) New

func (s *EtcdStore) New(r *http.Request, name string) (*sessions.Session, error)

New returns a session for the given name without adding it to the registry.

See gorilla/sessions CookieStore.New().

func (*EtcdStore) Save

func (s *EtcdStore) Save(_ *http.Request, w http.ResponseWriter, session *sessions.Session) error

Save adds a single session to the response.

Jump to

Keyboard shortcuts

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