缓存驱动更换成功,支持3级缓存,memory,以及db

This commit is contained in:
hoteas
2021-05-28 22:52:22 +08:00
parent fc315064e7
commit 1101937028
11 changed files with 369 additions and 126 deletions
+17 -4
View File
@@ -20,13 +20,26 @@ type HoTimeDBInterface interface {
}
type CacheDb struct {
Time int64
Db HoTimeDBInterface
Error
TimeOut int64
DbSet bool
SessionSet bool
Time int64
Db HoTimeDBInterface
*Error
ContextBase
isInit bool
}
func (this *CacheDb) GetError() *Error {
return this.Error
}
func (this *CacheDb) SetError(err *Error) {
this.Error = err
}
func (that *CacheDb) initDbTable() {
if that.isInit {
return
@@ -146,7 +159,7 @@ func (that *CacheDb) Cache(key string, data ...interface{}) *Obj {
}
if len(data) == 2 {
that.SetError(nil)
tempt := ObjToInt64(data[1], &that.Error)
tempt := ObjToInt64(data[1], that.Error)
if tempt > tim {
tim = tempt