couchbasestore

Gorilla's Session store for Couchbase

Github星跟蹤圖

GoDoc
couchbasestore

Gorilla's Session store implementation with Couchbase backend.

Gorilla's Sessions and their sessions store interface can be found here

Currently, this package supports storing sessions in only one bucket. In case your application demands to keep sessions in different buckets, implement a container that will have couchbasestore as the underlying struct.

Installation

Install this package as you would usually install any Go package.

Run go get github.com/srinathgs/couchbasestore from terminal. It gets installed in $GOPATH

Example

package main
import (
    "fmt"
    "net/http"
    "github.com/srinathgs/couchbasestore"
    "github.com/gorilla/mux"
)

var store, _ = couchbasestore.NewCouchStore("http://[<username>]:[<password>]@<ip>:<port>","<poolname>",
                                          "<bucketname>","/",3600,[]byte("secret-key"))
func foobar(w http.ResponseWriter, r *http.Request){
  session,err := store.Get(r,"foo") //name is the key against which a cookie is set in the HTTP header
  defer session.Save(r,w)
  session.Values["bar"] = "baz"
  fmt.Fprintf(w,"<h1>You have successfully accessed sessions.</h1>")
}

func main(){
  r := mux.NewRouter()
  r.HandleFunc("/foo/{bar}",foobar)
  http.Handle("/",r)
  http.ListenAndServe(":8081",nil)
}

主要指標

概覽
名稱與所有者srinathgs/couchbasestore
主編程語言Go
編程語言Go (語言數: 1)
平台
許可證Other
所有者活动
創建於2013-07-10 22:35:13
推送於2016-07-13 18:38:23
最后一次提交2013-11-21 13:36:56
發布數0
用户参与
星數9
關注者數1
派生數2
提交數30
已啟用問題?
問題數3
打開的問題數2
拉請求數0
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?