예제 #1
0
파일: register.go 프로젝트: chikhpykh/iris
package memory

import (
	"time"

	"github.com/kataras/iris/sessions"
	"github.com/kataras/iris/sessions/store"
)

func init() {
	register()
}

var (
	// Provider the memory provider
	Provider = sessions.NewProvider("memory")
)

// register registers itself (the new provider with its memory store) to the sessions providers
// must runs only once
func register() {
	// the actual work is here.
	Provider.NewStore = func(sessionId string, cookieLifeDuration time.Duration) store.IStore {
		return &Store{sid: sessionId, lastAccessedTime: time.Now(), values: make(map[string]interface{}, 0)}
	}
	sessions.Register(Provider)
}
예제 #2
0
파일: register.go 프로젝트: Carbyn/iris
import (
	"time"

	"github.com/kataras/iris/sessions"
	"github.com/kataras/iris/sessions/providers/redis/service"
	"github.com/kataras/iris/sessions/store"
)

func init() {
	register()
}

var (
	// Provider is the redis provider
	Provider = sessions.NewProvider("redis")
	// redis is the default redis service, you can set configs via this object
	redis = service.New()
	// Config is just the Redis(service)' config
	Config = redis.Config

// Empty() because maybe the user wants to edit the default configs.
//the Connect goes to the first NewStore, when user ask for session, so you have the time to change the default configs
)

// register registers itself (the new provider with its memory store) to the sessions providers
// must runs only once
func register() {
	// the actual work is here.
	Provider.NewStore = func(sessionId string, cookieLifeDuration time.Duration) store.IStore {
		//println("memory.go:49-> requesting new memory store with sessionid: " + sessionId)