All Projects → rbcervilla → redisstore

rbcervilla / redisstore

Licence: MIT license
A Gorilla Sessions Store implementation backed by Redis

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to redisstore

Php Storageless Sessions
Sessions handler which stores session data in HMAC-signed and encrypted cookies
Stars: ✭ 29 (-36.96%)
Mutual labels:  sessions
Sanic session
Provides server-backed sessions for Sanic using Redis, Memcache and more.
Stars: ✭ 131 (+184.78%)
Mutual labels:  sessions
OSC19-Linux-Workshop-Sessions
All of the workshop sessions of OSC'19 in .md and .pdf formats.
Stars: ✭ 45 (-2.17%)
Mutual labels:  sessions
Pgstore
A Postgres session store backend for gorilla/sessions
Stars: ✭ 66 (+43.48%)
Mutual labels:  sessions
Accounts
Fullstack authentication and accounts-management for Javascript.
Stars: ✭ 1,266 (+2652.17%)
Mutual labels:  sessions
Connect Session Sequelize
Sequelize SessionStore for Express/Connect
Stars: ✭ 179 (+289.13%)
Mutual labels:  sessions
Guardian auth
The Guardian Authentication Implementation Using Ecto/Postgresql Elixir Phoenix [ User Authentication ]
Stars: ✭ 15 (-67.39%)
Mutual labels:  sessions
WWDCNotes
WWDCNotes.com content
Stars: ✭ 343 (+645.65%)
Mutual labels:  sessions
Cash
HTTP response caching for Koa. Supports Redis, in-memory store, and more!
Stars: ✭ 122 (+165.22%)
Mutual labels:  sessions
Jeff
🍍Jeff provides the simplest way to manage web sessions in Go.
Stars: ✭ 223 (+384.78%)
Mutual labels:  sessions
Mern Login Signup Component
Minimalistic Sessions based Authentication app 🔒 using Reactjs, Nodejs, Express, MongoDB and Bootstrap. Uses Cookies 🍪
Stars: ✭ 74 (+60.87%)
Mutual labels:  sessions
Memorystore
express-session full featured MemoryStore layer without leaks!
Stars: ✭ 79 (+71.74%)
Mutual labels:  sessions
Wwdc Notes
WWDCNotes.com content ✨
Stars: ✭ 183 (+297.83%)
Mutual labels:  sessions
Django Qsessions
Extended session backends for Django (Sessions store IP, User Agent, and foreign key to User)
Stars: ✭ 64 (+39.13%)
Mutual labels:  sessions
mpv-scripts
A collection of scripts for mpv player
Stars: ✭ 138 (+200%)
Mutual labels:  sessions
Connect2ssh
Manage SSH and SSHFS connections via the command line using BASH!
Stars: ✭ 15 (-67.39%)
Mutual labels:  sessions
Go Sessions
🔐 The sessions manager for the Go Programming Language. Supports both net/http and fasthttp.
Stars: ✭ 134 (+191.3%)
Mutual labels:  sessions
PHP-MySQL-Sessions
Easily store PHP session data in a MySQL database
Stars: ✭ 67 (+45.65%)
Mutual labels:  sessions
redismock
Redis client Mock
Stars: ✭ 164 (+256.52%)
Mutual labels:  go-redis
Webwire Go
A transport independent asynchronous duplex messaging library for Go
Stars: ✭ 216 (+369.57%)
Mutual labels:  sessions

RedisStore

A Gorilla Sessions Store implementation backed by Redis.

It uses go-redis v8 as client to connect to Redis.

Example

package main

import (
    "context"
    "github.com/go-redis/redis/v8"
    "github.com/gorilla/sessions"
    "github.com/rbcervilla/redisstore/v8"
    "log"
    "net/http"
    "net/http/httptest"
)

func main() {

    client := redis.NewClient(&redis.Options{
        Addr:     "localhost:6379",
    })

    // New default RedisStore
    store, err := redisstore.NewRedisStore(context.Background(), client)
    if err != nil {
        log.Fatal("failed to create redis store: ", err)
    }

    // Example changing configuration for sessions
    store.KeyPrefix("session_")
    store.Options(sessions.Options{
        Path:   "/path",
        Domain: "example.com",
        MaxAge: 86400 * 60,
    })

    // Request y writer for testing
    req, _ := http.NewRequest("GET", "http://www.example.com", nil)
    w := httptest.NewRecorder()

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

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

    // Save session
    if err = sessions.Save(req, w); err != nil {
        log.Fatal("failed saving session: ", err)
    }

    // Delete session (MaxAge <= 0)
    session.Options.MaxAge = -1
    if err = sessions.Save(req, w); err != nil {
        log.Fatal("failed deleting session: ", err)
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].