mirror of
https://gitee.com/johng/gf
synced 2026-07-06 05:42:20 +08:00
gins单例管理增加配置文件监控功能
This commit is contained in:
@ -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")
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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"))
|
||||
}
|
||||
Reference in New Issue
Block a user