缓存驱动更换成功,支持3级缓存,memory,以及db
This commit is contained in:
Vendored
+17
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user