Documentation ¶
Overview ¶
Package couchbasestore implements the Gorilla toolkit's sessions store for couchbase. Gorilla's Sessions and their sessions store interface can be found at https://github.com/gorilla/sessions
Couchbasestore is NOT thread-safe.
This package is backwards compatible with the original package by Srinath. The original can be found at https://github.com/srinathgs/couchbasestore
Copyright 2013 Srinath. All rights Reserved. Copyright 2015 drathier. All rights Reserved. This Software is licensed under MIT license available in the LICENSE file.
Index ¶
- Variables
- type CouchStore
- func New(bucket *couchbase.Bucket, cookiePath string, cookieMaxAge int, ...) (*CouchStore, error)
- func NewCouchStore(endpoint string, pool string, bucket string, cookiePath string, ...) (*CouchStore, error)
- func NewFromURI(endpoint string, pool string, bucketName string, cookiePath string, ...) (*CouchStore, error)
- func (c *CouchStore) Close()
- func (c *CouchStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (c *CouchStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (c *CouchStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (c *CouchStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Constants ¶
This section is empty.
Variables ¶
var BaseRetryDuration = 50 * time.Millisecond
Duration between retries. Increases exponentially with subsequent failed attempts. Retries stop after roughly 1/2 * Retries*(Retries+1) * BaseRetryDuration.
var ErrMaxAge = errors.New("max age should be greater than zero")
MaxAge error.
var Retries = 5
Number of retries. The program that uses this package can change this.
Functions ¶
This section is empty.
Types ¶
type CouchStore ¶
type CouchStore struct {
// contains filtered or unexported fields
}
CouchStore implements the gorilla/sessions Store interface
func New ¶
func New(bucket *couchbase.Bucket, cookiePath string, cookieMaxAge int, keyPairs ...[]byte) (*CouchStore, error)
New creates a CouchStore using an existing couchbase.Bucket.
func NewCouchStore ¶
func NewCouchStore(endpoint string, pool string, bucket string, cookiePath string, cookieMaxAge int, keyPairs ...[]byte) (*CouchStore, error)
NewCouchStore is a backwards-compatible alias for New.
func NewFromURI ¶
func NewFromURI(endpoint string, pool string, bucketName string, cookiePath string, cookieMaxAge int, keyPairs ...[]byte) (*CouchStore, error)
NewFromURI creates a new CouchStore with a new couchbase.Bucket.
func (*CouchStore) Delete ¶
func (c *CouchStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Delete deletes session from CouchStore and HTTP cookie stores.
func (*CouchStore) Get ¶
Get Session data from CouchStore. name is the key in the cookie against which the cookie string is set.
func (*CouchStore) New ¶
New creates a new session. CouchStore.Get will perform this in case there is no existing session.
func (*CouchStore) Save ¶
func (c *CouchStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save saves the session to couchbase using bucket c.bucket.