Skip to content

boxgo/redisstore

Repository files navigation

redisstore

GoDoc Build Status Coverage Status Go Report Card

A session store backend for gorilla/sessions - src.

Features

  • Support Redis Sentinel, Cluster, Standalone
  • Support secure cookie
  • Support json, gob serializer or custom serializer
  • Support MaxLength, KeyPrefix and KeyGenFunc options

Installation

    go get github.com/boxgo/redisstore

Requirements

Depends on the go-redis/redis Redis library.

Example

client := redis.NewUniversalClient(&redis.UniversalOptions{
    Addrs: []string{"localhost:6379"},
    DB:    0,
})

store, err := NewStoreWithUniversalClient(client,
    WithKeyPairs([]byte("test")),
    WithKeyPrefix("session_"),
    WithSerializer(&serializer.JSONSerializer{}),
)