...
1 package sessions
2
3 import (
4 "github.com/boj/redistore"
5 "github.com/gorilla/sessions"
6 )
7
8 type RedisStore interface {
9 Store
10 }
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 func NewRedisStore(size int, network, address, password string, keyPairs ...[]byte) (RedisStore, error) {
26 store, err := redistore.NewRediStore(size, network, address, password, keyPairs...)
27 if err != nil {
28 return nil, err
29 }
30 return &redisStore{store}, nil
31 }
32
33 type redisStore struct {
34 *redistore.RediStore
35 }
36
37 func (c *redisStore) Options(options Options) {
38 c.RediStore.Options = &sessions.Options{
39 Path: options.Path,
40 Domain: options.Domain,
41 MaxAge: options.MaxAge,
42 Secure: options.Secure,
43 HttpOnly: options.HttpOnly,
44 }
45 }
46
View as plain text