Documentation
¶
Index ¶
- type DaprStateStore
- func (s *DaprStateStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (s *DaprStateStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (s *DaprStateStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (s *DaprStateStore) SetKeyPrefix(p string)
- func (s *DaprStateStore) SetMaxAge(v int)
- func (s *DaprStateStore) SetMaxLength(l int)
- func (s *DaprStateStore) SetSerializer(ss SessionSerializer)
- type GobSerializer
- type JSONSerializer
- type SessionSerializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DaprStateStore ¶
type DaprStateStore struct { Client *dapr.Client StateStoreName string Codecs []securecookie.Codec Options *sessions.Options // default configuration DefaultMaxAge int // default Redis TTL for a MaxAge == 0 session // contains filtered or unexported fields }
DaprStateStore stores sessions in a Dapr State Store backend.
func NewDaprStateStore ¶
func NewDaprStateStore(stateStoreName string, keyPairs ...[]byte) (*DaprStateStore, error)
NewDaprStateStore returns a new DaprStateStore. size: maximum number of idle connections.
func (*DaprStateStore) Get ¶
Get returns a session for the given name after adding it to the registry.
See gorilla/sessions FilesystemStore.Get().
func (*DaprStateStore) New ¶
New returns a session for the given name without adding it to the registry.
See gorilla/sessions FilesystemStore.New().
func (*DaprStateStore) Save ¶
func (s *DaprStateStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save adds a single session to the response.
func (*DaprStateStore) SetKeyPrefix ¶
func (s *DaprStateStore) SetKeyPrefix(p string)
SetKeyPrefix set the prefix
func (*DaprStateStore) SetMaxAge ¶
func (s *DaprStateStore) SetMaxAge(v int)
SetMaxAge restricts the maximum age, in seconds, of the session record both in database and a browser. This is to change session storage configuration. If you want just to remove session use your session `s` object and change it's `Options.MaxAge` to -1, as specified in
http://godoc.org/github.com/gorilla/sessions#Options
Default is the one provided by this package value - `sessionExpire`. Set it to 0 for no restriction. Because we use `MaxAge` also in SecureCookie crypting algorithm you should use this function to change `MaxAge` value.
func (*DaprStateStore) SetMaxLength ¶
func (s *DaprStateStore) SetMaxLength(l int)
SetMaxLength sets DaprStateStore.maxLength if the `l` argument is greater or equal 0 maxLength restricts the maximum length of new sessions to l. If l is 0 there is no limit to the size of a session, use with caution. The default for a new DaprStateStore is 16KB. Default: 16KB,
func (*DaprStateStore) SetSerializer ¶
func (s *DaprStateStore) SetSerializer(ss SessionSerializer)
SetSerializer sets the serializer
type GobSerializer ¶
type GobSerializer struct{}
GobSerializer uses gob package to encode the session map
func (GobSerializer) Deserialize ¶
func (s GobSerializer) Deserialize(d []byte, ss *sessions.Session) error
Deserialize back to map[interface{}]interface{}
type JSONSerializer ¶
type JSONSerializer struct{}
JSONSerializer encode the session map to JSON.
func (JSONSerializer) Deserialize ¶
func (s JSONSerializer) Deserialize(d []byte, ss *sessions.Session) error
Deserialize back to map[string]interface{}