A session store backend for gorilla/sessions - src.
- Support Redis Sentinel, Cluster, Standalone
- Support secure cookie
- Support json, gob serializer or custom serializer
- Support
MaxLength
,KeyPrefix
andKeyGenFunc
options
go get github.com/boxgo/redisstore
Depends on the go-redis/redis Redis library.
client := redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: []string{"localhost:6379"},
DB: 0,
})
store, err := NewStoreWithUniversalClient(client,
WithKeyPairs([]byte("test")),
WithKeyPrefix("session_"),
WithSerializer(&serializer.JSONSerializer{}),
)