1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

Update to version 8.5.5

Former-commit-id: b5be58709f17758a8df3ebc99270b97ccd8b18f2
This commit is contained in:
kataras
2017-11-02 05:50:56 +02:00
parent 6607008054
commit 666bcacf20
97 changed files with 38154 additions and 38162 deletions

View File

@@ -14,8 +14,6 @@ func main() {
if err != nil {
panic(err)
}
// use different go routines to sync the database
db.Async(true)
// close and unlock the database when control+C/cmd+C pressed
iris.RegisterOnInterrupt(func() {
@@ -44,7 +42,7 @@ func main() {
s.Set("name", "iris")
//test if setted here
ctx.Writef("All ok session setted to: %s", s.GetString("name"))
ctx.Writef("All ok session value of the 'name' is: %s", s.GetString("name"))
})
app.Get("/set/{key}/{value}", func(ctx iris.Context) {
@@ -54,14 +52,14 @@ func main() {
s.Set(key, value)
// test if setted here
ctx.Writef("All ok session setted to: %s", s.GetString(key))
ctx.Writef("All ok session value of the '%s' is: %s", key, s.GetString(key))
})
app.Get("/get", func(ctx iris.Context) {
// get a specific key, as string, if no found returns just an empty string
name := sess.Start(ctx).GetString("name")
ctx.Writef("The name on the /set was: %s", name)
ctx.Writef("The 'name' on the /set was: %s", name)
})
app.Get("/get/{key}", func(ctx iris.Context) {
@@ -91,5 +89,5 @@ func main() {
sess.ShiftExpiration(ctx)
})
app.Run(iris.Addr(":8080"))
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed), iris.WithoutVersionChecker)
}

View File

@@ -11,8 +11,6 @@ import (
func main() {
db, _ := boltdb.New("./sessions/sessions.db", 0666, "users")
// use different go routines to sync the database
db.Async(true)
// close and unlock the database when control+C/cmd+C pressed
iris.RegisterOnInterrupt(func() {

View File

@@ -5,19 +5,19 @@ import (
"github.com/kataras/iris"
"github.com/gorilla/securecookie"
"github.com/kataras/iris/sessions"
"github.com/kataras/iris/sessions/sessiondb/file"
)
func main() {
db, _ := file.New("./sessions/", 0666)
// use different go routines to sync the database
db.Async(true)
db, _ := file.New("./sessions/", 0755)
sess := sessions.New(sessions.Config{
Cookie: "sessionscookieid",
Expires: 45 * time.Minute, // <=0 means unlimited life
Expires: 24 * time.Hour, // <=0 means unlimited life
Encoding: securecookie.New([]byte("C2O6J6oYTd0CBCNERkWZK8jGOXTXf9X2"),
[]byte("UTp6fJsicraGxA2cslELrrLX7msg5jfE")),
})
//
@@ -84,5 +84,5 @@ func main() {
sess.ShiftExpiration(ctx)
})
app.Run(iris.Addr(":8080"))
app.Run(iris.Addr(":8080"), iris.WithoutVersionChecker)
}

View File

@@ -12,9 +12,6 @@ import (
func main() {
db, _ := leveldb.New("./sessions/")
// use different go routines to sync the database
db.Async(true)
// close and unlock the database when control+C/cmd+C pressed
iris.RegisterOnInterrupt(func() {
db.Close()

View File

@@ -22,8 +22,6 @@ func main() {
IdleTimeout: service.DefaultRedisIdleTimeout,
Prefix: ""}) // optionally configure the bridge between your redis server
// use go routines to query the database
db.Async(true)
// close connection when control+C/cmd+C
iris.RegisterOnInterrupt(func() {
db.Close()