Documentation
¶
Overview ¶
Package rethinkstore is a session store backend for gorilla/sessions using Rethinkdb.
Index ¶
- Variables
- type RethinkSession
- type RethinkStore
- func (s *RethinkStore) Close()
- func (s *RethinkStore) Count() (uint, error)
- func (s *RethinkStore) DeleteExpired() error
- func (s *RethinkStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (s *RethinkStore) MaxAge(age int)
- func (s *RethinkStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (s *RethinkStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoDatabase = errors.New("no databases available")
Functions ¶
This section is empty.
Types ¶
type RethinkSession ¶
type RethinkStore ¶
type RethinkStore struct {
Rethink *r.Session // rethink session
Table string // table to store sessions in
Codecs []securecookie.Codec // session codecs
Options *sessions.Options // default configuration
DefaultMaxAge int // default TTL for a MaxAge == 0 session
}
RethinkStore stores sessions in a rethinkdb backend.
Example ¶
// RethinkStore
store, err := NewRethinkStore("127.0.0.1:28015", TestDatabase, TestTable, 5, 5, []byte("secret-key"))
if err != nil {
panic(err)
}
defer store.Close()
func NewRethinkStore ¶
func NewRethinkStore(addr, db, table string, idle, open int, keyPairs ...[]byte) (*RethinkStore, error)
NewRethinkStore returns a new RethinkStore.
Takes in the database address, database name, session table, max idle connections, max open connections, and session key pairs.
func (*RethinkStore) Close ¶
func (s *RethinkStore) Close()
Close closes the underlying Rethink Client.
func (*RethinkStore) Count ¶
func (s *RethinkStore) Count() (uint, error)
func (*RethinkStore) DeleteExpired ¶
func (s *RethinkStore) DeleteExpired() error
Deletes expired entries
func (*RethinkStore) Get ¶
Get returns a session for the given name after adding it to the registry.
func (*RethinkStore) MaxAge ¶
func (s *RethinkStore) 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 (*RethinkStore) New ¶
New returns a session for the given name without adding it to the registry.
func (*RethinkStore) Save ¶
func (s *RethinkStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save adds a single session to the response.