See all methods The sessions manager is created using the `New` package-level function. ```go import "github.com/kataras/iris/v12/sessions" sess := sessions.New(sessions.Config{Cookie: "cookieName", ...}) ``` Where `Config` looks like that. ```go SessionIDGenerator func(iris.Context) string // Defaults to "irissessionid". Cookie string CookieSecureTLS bool // Defaults to false. AllowReclaim bool // Defaults to nil. Encode func(cookieName string, value interface{}) (string, error) // Defaults to nil. Decode func(cookieName string, cookieValue string, v interface{}) error // Defaults to nil. Encoding Encoding // Defaults to infinitive/unlimited life duration(0). Expires time.Duration // Defaults to false. DisableSubdomainPersistence bool ``` The return value a `Sessions` pointer exports the following methods. ```go Start(ctx iris.Context, cookieOptions ...iris.CookieOption) *Session Destroy() DestroyAll() DestroyByID(sessID string) OnDestroy(callback func(sid string)) ShiftExpiration(ctx iris.Context, cookieOptions ...iris.CookieOption) error UpdateExpiration(ctx iris.Context, expires time.Duration, cookieOptions ...iris.CookieOption) error UseDatabase(db Database) ``` Where `CookieOption` is just a `func(*iris.Cookie)` which allows to customize cookie's properties. The `Start` method returns a `Session` pointer value which exports its own methods to work per session. ```go func (ctx iris.Context) { session := sess.Start(ctx) .ID() string .IsNew() bool .Set(key string, value interface{}) .SetImmutable(key string, value interface{}) .GetAll() map[string]interface{} .Delete(key string) bool .Clear() .Get(key string) interface{} .GetString(key string) string .GetStringDefault(key string, defaultValue string) string .GetInt(key string) (int, error) .GetIntDefault(key string, defaultValue int) int .Increment(key string, n int) (newValue int) .Decrement(key string, n int) (newValue int) .GetInt64(key string) (int64, error) .GetInt64Default(key string, defaultValue int64) int64 .GetFloat32(key string) (float32, error) .GetFloat32Default(key string, defaultValue float32) float32 .GetFloat64(key string) (float64, error) .GetFloat64Default(key string, defaultValue float64) float64 .GetBoolean(key string) (bool, error) .GetBooleanDefault(key string, defaultValue bool) bool .SetFlash(key string, value interface{}) .HasFlash() bool .GetFlashes() map[string]interface{} .PeekFlash(key string) interface{} .GetFlash(key string) interface{} .GetFlashString(key string) string .GetFlashStringDefault(key string, defaultValue string) string .DeleteFlash(key string) .ClearFlashes() .Destroy() } ```