func (en *sessionEngine) Init(cf *conf.Conf) error {
	if cf.Redis == nil {
		logs.Errors("init conf", ErrorNotFondRedisConf)
		return ErrorNotFondRedisConf
	}
	en.cf = cf
	en.c = redis.NewClient(&redis.Options{
		Addr:     cf.Redis.Addrs,
		Password: cf.Redis.Password,
		PoolSize: cf.Redis.PoolSize,
	})
	err := en.c.Ping().Err()
	if err != nil {
		logs.Errors("connection error", err)
	}
	return err
}
set session value by key
package standalone
import (
	"errors"
	"sync"
	"time"
	"github.com/axfor/bast/logs"
	"github.com/axfor/bast/session/conf"
	"github.com/axfor/bast/session/engine"
	"github.com/axfor/bast/session/serde"
	"github.com/go-redis/redis"
)
var ErrorConn = errors.New("connection to redis error")
var ErrorNotFondRedisConf = errors.New("not fond redis conf")
var sengine = &sessionEngine{}
type sessionStore struct {
	lock *sync.RWMutex
	en   *sessionEngine
	id   string                  
	data map[string]interface{}  
}
func (s *sessionStore) Set(key string, value interface{}) error {
	if s.lock != nil {
		s.lock.Lock()
		defer s.lock.Unlock()
	}
	s.data[key] = value
	return nil
}
func (s *sessionStore) Get(key string) interface{} {
	if s.lock != nil {
		s.lock.RLock()
		defer s.lock.RUnlock()
	}
	if v, ok := s.data[key]; ok {
		return v
	}
	return nil
}
func (s *sessionStore) Delete(key string) error {
	if s.lock != nil {
		s.lock.Lock()
		defer s.lock.Unlock()
	}
	delete(s.data, key)
	return nil
}
func (s *sessionStore) ID() string {
	return s.id
}
func (s *sessionStore) Clear() error {
	if s.lock != nil {
		s.lock.Lock()
		defer s.lock.Unlock()
	}
	s.data = nil
	s.data = map[string]interface{}{}
	return nil
}
func (s *sessionStore) Commit() error {
	if s.en.c == nil {
		logs.Errors("connection error", ErrorConn)
		return ErrorConn
	}
	be, err := serde.Encode(s.data)
	if err != nil {
		return err
	}
	err = s.en.c.Set(s.id, string(be), time.Duration(s.en.cf.LifeTime)*time.Second).Err()
	return err
}
func (s *sessionStore) NeedRecycle() bool {
	return false
}
type sessionEngine struct {
	c  *redis.Client
	cf *conf.Conf
}