1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/vendor/github.com/gin-contrib/sessions/memcached.go

33 lines
764 B
Go
Raw Normal View History

2017-10-03 21:43:55 +03:00
package sessions
import (
"github.com/bradfitz/gomemcache/memcache"
"github.com/bradleypeabody/gorilla-sessions-memcache"
"github.com/gorilla/sessions"
)
type MemcachedStore interface {
Store
}
// client: memcache client.
// keyPrefix: prefix for the keys we store.
func NewMemcacheStore(client *memcache.Client, keyPrefix string, keyPairs ...[]byte) MemcachedStore {
store := gsm.NewMemcacheStore(client, keyPrefix, keyPairs...)
return &memcacheStore{store}
}
type memcacheStore struct {
*gsm.MemcacheStore
}
func (c *memcacheStore) Options(options Options) {
c.MemcacheStore.Options = &sessions.Options{
Path: options.Path,
Domain: options.Domain,
MaxAge: options.MaxAge,
Secure: options.Secure,
HttpOnly: options.HttpOnly,
}
}