couchbasestore

Gorilla's Session store for Couchbase

  • 所有者: srinathgs/couchbasestore
  • 平台:
  • 许可证: Other
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

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 14:35:13
推送于2016-07-13 10:38:23
最后一次提交2013-11-21 11:06:56
发布数0
用户参与
星数9
关注者数1
派生数2
提交数30
已启用问题?
问题数3
打开的问题数2
拉请求数0
打开的拉请求数1
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?