couchbasestore

Gorilla's Session store for Couchbase

  • Owner: srinathgs/couchbasestore
  • Platform:
  • License:: Other
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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)
}

Main metrics

Overview
Name With Ownersrinathgs/couchbasestore
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:Other
所有者活动
Created At2013-07-10 14:35:13
Pushed At2016-07-13 10:38:23
Last Commit At2013-11-21 11:06:56
Release Count0
用户参与
Stargazers Count9
Watchers Count1
Fork Count2
Commits Count30
Has Issues Enabled
Issues Count3
Issue Open Count2
Pull Requests Count0
Pull Requests Open Count1
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private