func (s *Store) Set(sess *simplesessions.Session, cv, key string, val interface{}) error {
	s.mu.Lock()
	defer s.mu.Unlock()
	if _, ok := s.tempSetMap[cv]; !ok {
		s.tempSetMap[cv] = make(map[string]interface{})
	}
	s.tempSetMap[cv][key] = val
	return nil
}
Set sets a field in session but not saved untill commit is called.
package securecookie
import (
	"sync"
	"github.com/gorilla/securecookie"
	"github.com/vividvilla/simplesessions"
)
const (
	defaultCookieName = "session"
)
type Store struct {
	tempSetMap map[string]map[string]interface{}
	mu         sync.RWMutex
	sc         *securecookie.SecureCookie
	cookieName string
}
func New(secretKey []byte, blockKey []byte) *Store {
	return &Store{
		cookieName: defaultCookieName,
		sc:         securecookie.New(secretKey, blockKey),
		tempSetMap: make(map[string]map[string]interface{}),
	}
}
func (s *Store) encode(val interface{}) (string, error) {
	return s.sc.Encode(s.cookieName, val)
}
func (s *Store) decode(cookieVal string) (map[string]interface{}, error) {
	val := make(map[string]interface{})
	err := s.sc.Decode(s.cookieName, cookieVal, &val)
	return val, err
}
func (s *Store) SetCookieName(cookieName string) {
	s.cookieName = cookieName
}
func (s *Store) IsValid(sess *simplesessions.Session, cv string) (bool, error) {
	if _, err := s.decode(cv); err != nil {
		return false, nil
	}
	return true, nil
}
func (s *Store) Create(sess *simplesessions.Session) (string, error) {
	return s.encode(make(map[string]interface{}))
}
func (s *Store) Get(sess *simplesessions.Session, cv, key string) (interface{}, error) {
	vals, err := s.decode(cv)
	if err != nil {
		return nil, simplesessions.ErrInvalidSession
	}
	val, ok := vals[key]
	if !ok {
		return nil, simplesessions.ErrFieldNotFound
	}
	return val, nil
}
func (s *Store) GetMulti(sess *simplesessions.Session, cv string, keys ...string) (map[string]interface{}, error) {
	vals, err := s.decode(cv)
	if err != nil {
		return nil, simplesessions.ErrInvalidSession
	}
	res := make(map[string]interface{})
	for _, k := range keys {
		res[k], _ = vals[k]
	}
	return res, nil
}
func (s *Store) GetAll(sess *simplesessions.Session, cv string) (map[string]interface{}, error) {
	vals, err := s.decode(cv)
	if err != nil {
		return nil, simplesessions.ErrInvalidSession
	}
	return vals, nil
}