gins单例管理增加配置文件监控功能

This commit is contained in:
John
2018-04-21 11:20:31 +08:00
parent 7043b3ebb2
commit 0daaea8919
6 changed files with 30 additions and 9 deletions

View File

@ -8,6 +8,7 @@ import (
func main() {
gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/gitee.com/johng/gf/geg/frame")
redis := gins.Redis("cache")
redis.Do("SET", "k", "v")
v, _ := redis.Do("GET", "k")

View File

@ -24,4 +24,4 @@ database:
# Redis数据库配置
redis:
disk: 127.0.0.1:6379,0
cache: 127.0.0.1:6379,1
cache: 127.0.0.1:6379,2

View File

@ -6,7 +6,7 @@ import (
)
func main() {
err := gfsnotify.Add("/home/john/Documents/temp", func(event *gfsnotify.Event) {
err := gfsnotify.Add("/home/john/Documents/temp.txt", func(event *gfsnotify.Event) {
if event.IsCreate() {
log.Println("创建文件 : ", event.Path)
}

View File

@ -2,9 +2,9 @@ package main
import (
"fmt"
"strconv"
"gitee.com/johng/gf/g/frame/gins"
)
func main() {
fmt.Println(strconv.Atoi("11"))
fmt.Println(gins.Config().GetString("database.default.0.host"))
}