Skip to content

shampur/etcdstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Etcd store

A session store backend for gorilla/sessions - src using Etcd.

Requirements

Depends on etcd client Etcd-client.

Installation

go get github.com/shampur/etcdstore

Documentation

Available on godoc.org.

See http://www.gorillatoolkit.org/pkg/sessions for full documentation on underlying interface.

Example

// Fetch new store.
addrs := []string{"127.0.0.1:2379"}
store := NewEtcdStore([]string{"http://127.0.0.1:2379"}, "session-name", []byte("something-very-secret")),

// Get a session.
session, err := store.Get(req, "session-key")
if err != nil {
    log.Error(err.Error())
}

// Add a value.
session.Values["foo"] = "bar"

// Save.
if err = sessions.Save(req, rsp); err != nil {
    t.Fatalf("Error saving session: %v", err)
}

// Delete session.
session.Options.MaxAge = -1
if err = sessions.Save(req, rsp); err != nil {
    t.Fatalf("Error saving session: %v", err)
}

About

store implementation for gorilla sessions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages