时间函数使用utc时间计算,预防切换夏令时bug

This commit is contained in:
ayflying
2025-02-25 15:19:42 +08:00
parent 4862dcd1d8
commit 36a34891db
5 changed files with 232 additions and 21 deletions

View File

@@ -4,6 +4,10 @@ import (
"context"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/os/gcache"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/util/gconv"
"path"
"strings"
"time"
)
@@ -12,8 +16,20 @@ type AdapterFile struct {
}
func (a AdapterFile) Set(ctx context.Context, key interface{}, value interface{}, duration time.Duration) error {
//TODO implement me
panic("implement me")
//defer a.handleLruKey(ctx, key)
//expireTime := a.getInternalExpire(duration)
//a.data.Set(key, memoryDataItem{
// a: value,
// a: expireTime,
//})
//c.eventList.PushBack(&adapterMemoryEvent{
// k: key,
// e: expireTime,
//})
arr := strings.Split(":", gconv.String(key))
fileName := path.Join(arr...)
return gfile.PutBytes(fileName, gconv.Bytes(value))
}
func (a AdapterFile) SetMap(ctx context.Context, data map[interface{}]interface{}, duration time.Duration) error {