mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
fix: ExampleGetContentsWithCache intlog
This commit is contained in:
@ -4,10 +4,12 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/v2/internal/intlog"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
)
|
||||
|
||||
func ExampleGetContentsWithCache() {
|
||||
intlog.SetEnabled(false)
|
||||
// init
|
||||
fileName := "123.txt"
|
||||
tempDir := gfile.TempDir("gfile_example_cache")
|
||||
@ -32,6 +34,8 @@ func ExampleGetContentsWithCache() {
|
||||
// write new contents will clear its cache
|
||||
gfile.PutContents(tempFile, "new test contents")
|
||||
|
||||
time.Sleep(time.Second * 1)
|
||||
|
||||
// read contents
|
||||
content2 := gfile.GetContentsWithCache(tempFile)
|
||||
fmt.Println(content2)
|
||||
|
||||
Reference in New Issue
Block a user