func (m *MemoryStorer) Set(key, value string) error {
	m.mut.Lock()
	m.sessions[key] = memorySession{
		expires: time.Now().UTC().Add(m.maxAge),
		value:   value,
	}
	m.mut.Unlock()
	return nil
}
Set saves the value string to the session pointed to by the session id key.
package abcsessions
import (
	"sync"
	"time"
)
type MemoryStorer struct {
	sessions map[string]memorySession
	maxAge time.Duration
	cleanInterval time.Duration
	mut sync.RWMutex
	wg sync.WaitGroup
	quit chan struct{}
}
type memorySession struct {
	expires time.Time
	value   string
}
func NewDefaultMemoryStorer() (*MemoryStorer, error) {
	return NewMemoryStorer(time.Hour*24*2, time.Hour)
}
func NewMemoryStorer(maxAge, cleanInterval time.Duration) (*MemoryStorer, error) {
	if (maxAge != 0 && cleanInterval == 0) || (cleanInterval != 0 && maxAge == 0) {
		panic("if max age or clean interval is set, the other must also be set")
	}
	m := &MemoryStorer{
		sessions:      make(map[string]memorySession),
		maxAge:        maxAge,
		cleanInterval: cleanInterval,
	}
	return m, nil
}
func (m *MemoryStorer) All() ([]string, error) {
	m.mut.RLock()
	defer m.mut.RUnlock()
	sessions := make([]string, len(m.sessions))
	i := 0
	for id := range m.sessions {
		sessions[i] = id
		i++
	}
	return sessions, nil
}
func (m *MemoryStorer) Get(key string) (value string, err error) {
	m.mut.RLock()
	session, ok := m.sessions[key]
	m.mut.RUnlock()
	if !ok {
		return "", errNoSession{}
	}
	return session.value, nil
}