mirror of
https://github.com/kataras/iris.git
synced 2025-02-09 02:34:55 +01:00
add the new Driver config field on the wiki
parent
3b0faa1f64
commit
f2b6c50e11
|
@ -22,7 +22,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// 2. Initialize the database.
|
// 2. Initialize the database.
|
||||||
// Replace with your running redis' server settings:
|
// These are the default values,
|
||||||
|
// you can replace them based on your running redis' server settings:
|
||||||
db := redis.New(redis.Config{
|
db := redis.New(redis.Config{
|
||||||
Network: "tcp",
|
Network: "tcp",
|
||||||
Addr: "127.0.0.1:6379",
|
Addr: "127.0.0.1:6379",
|
||||||
|
@ -31,8 +32,17 @@ db := redis.New(redis.Config{
|
||||||
Password: "",
|
Password: "",
|
||||||
Database: "",
|
Database: "",
|
||||||
Prefix: "",
|
Prefix: "",
|
||||||
|
Delim: "-",
|
||||||
|
Driver: redis.Redigo(), // redis.Radix() can be used instead.
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Optionally configure the underline driver:
|
||||||
|
// driver := redis.Redigo()
|
||||||
|
// driver.MaxIdle = ...
|
||||||
|
// driver.IdleTimeout = ...
|
||||||
|
// driver.Wait = ...
|
||||||
|
// redis.Config {Driver: driver}
|
||||||
|
|
||||||
// Close connection when control+C/cmd+C
|
// Close connection when control+C/cmd+C
|
||||||
iris.RegisterOnInterrupt(func() {
|
iris.RegisterOnInterrupt(func() {
|
||||||
db.Close()
|
db.Close()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user