Skip to content
/ riakstore Public

A session store backend for gorilla/sessions using Riak.

License

Notifications You must be signed in to change notification settings

boj/riakstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

riakstore

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

Requirements

Depends on the Riaken riaken-core Riak library.

Installation

go get github.com/boj/riakstore

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:8083", "127.0.0.1:8084", "127.0.0.1:8085", "127.0.0.1:8086", "127.0.0.1:8087"}
store := NewRiakStore(addrs, 5, "sessions", []byte("secret-key"))
defer store.Close()

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

Notes

See http://docs.basho.com/riak/latest/ops/advanced/backends/multi/ for how to configure multiple backends and bucket level TTL props.

Additional FAQs on TTL:

About

A session store backend for gorilla/sessions using Riak.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages