func (s *Registry) Get(store Store, name string) (session *Session, err error) {
	if !isCookieNameValid(name) {
		return nil, fmt.Errorf("sessions: invalid character in cookie name: %s", name)
	}
	if info, ok := s.sessions[name]; ok {
		session, err = info.s, info.e
	} else {
		session, err = store.New(s.request, name)
		session.name = name
		s.sessions[name] = sessionInfo{s: session, e: err}
	}
	session.store = store
	return
}
Get registers and returns a session for the given name and session store.

It returns a new session if there are no sessions registered for the name.
package sessions
import (
	"encoding/gob"
	"fmt"
	"net/http"
	"time"
	"github.com/gorilla/context"
)
const flashesKey = "_flash"
type Options struct {
	Path   string
	Domain string
	MaxAge   int
	Secure   bool
	HttpOnly bool
}
func NewSession(store Store, name string) *Session {
	return &Session{
		Values: make(map[interface{}]interface{}),
		store:  store,
		name:   name,
	}
}
type Session struct {
	ID      string
	Values  map[interface{}]interface{}
	Options *Options
	IsNew   bool
	store   Store
	name    string
}
func (s *Session) Flashes(vars ...string) []interface{} {
	var flashes []interface{}
	key := flashesKey
	if len(vars) > 0 {
		key = vars[0]
	}
	if v, ok := s.Values[key]; ok {
		delete(s.Values, key)
		flashes = v.([]interface{})
	}
	return flashes
}
func (s *Session) AddFlash(value interface{}, vars ...string) {
	key := flashesKey
	if len(vars) > 0 {
		key = vars[0]
	}
	var flashes []interface{}
	if v, ok := s.Values[key]; ok {
		flashes = v.([]interface{})
	}
	s.Values[key] = append(flashes, value)
}
func (s *Session) Save(r *http.Request, w http.ResponseWriter) error {
	return s.store.Save(r, w, s)
}
func (s *Session) Name() string {
	return s.name
}
func (s *Session) Store() Store {
	return s.store
}
type sessionInfo struct {
	s *Session
	e error
}
type contextKey int
const registryKey contextKey = 0
func GetRegistry(r *http.Request) *Registry {
	registry := context.Get(r, registryKey)
	if registry != nil {
		return registry.(*Registry)
	}
	newRegistry := &Registry{
		request:  r,
		sessions: make(map[string]sessionInfo),
	}
	context.Set(r, registryKey, newRegistry)
	return newRegistry
}
type Registry struct {
	request  *http.Request
	sessions map[string]sessionInfo
}