use logrus to project default log tools
This commit is contained in:
+27
-27
@@ -14,63 +14,63 @@ type SessionIns struct {
|
||||
ContextBase
|
||||
}
|
||||
|
||||
func (this *SessionIns) set() {
|
||||
func (that *SessionIns) set() {
|
||||
|
||||
if this.ShortCache != nil {
|
||||
this.ShortCache.Cache(HEAD_SESSION_ADD+this.SessionId, this.Map)
|
||||
if that.ShortCache != nil {
|
||||
that.ShortCache.Cache(HEAD_SESSION_ADD+that.SessionId, that.Map)
|
||||
}
|
||||
if this.LongCache != nil {
|
||||
this.LongCache.Cache(HEAD_SESSION_ADD+this.SessionId, this.Map)
|
||||
if that.LongCache != nil {
|
||||
that.LongCache.Cache(HEAD_SESSION_ADD+that.SessionId, that.Map)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (this *SessionIns) Session(key string, data ...interface{}) *Obj {
|
||||
func (that *SessionIns) Session(key string, data ...interface{}) *Obj {
|
||||
|
||||
if this.Map == nil {
|
||||
this.get()
|
||||
if that.Map == nil {
|
||||
that.get()
|
||||
}
|
||||
|
||||
if len(data) != 0 {
|
||||
if data[0] == nil {
|
||||
delete(this.Map, key)
|
||||
this.set()
|
||||
delete(that.Map, key)
|
||||
that.set()
|
||||
} else {
|
||||
this.Map[key] = data[0]
|
||||
this.set()
|
||||
that.Map[key] = data[0]
|
||||
that.set()
|
||||
}
|
||||
return &Obj{Data: nil}
|
||||
}
|
||||
|
||||
return &Obj{Data: this.Map.Get(key)}
|
||||
return &Obj{Data: that.Map.Get(key)}
|
||||
|
||||
}
|
||||
|
||||
func (this *SessionIns) get() {
|
||||
func (that *SessionIns) get() {
|
||||
|
||||
if this.ShortCache != nil {
|
||||
this.Map = this.ShortCache.Cache(HEAD_SESSION_ADD + this.SessionId).ToMap()
|
||||
if this.Map != nil {
|
||||
if that.ShortCache != nil {
|
||||
that.Map = that.ShortCache.Cache(HEAD_SESSION_ADD + that.SessionId).ToMap()
|
||||
if that.Map != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if this.LongCache != nil {
|
||||
this.Map = this.LongCache.Cache(HEAD_SESSION_ADD + this.SessionId).ToMap()
|
||||
if this.Map != nil {
|
||||
if this.ShortCache != nil {
|
||||
this.ShortCache.Cache(HEAD_SESSION_ADD+this.SessionId, this.Map)
|
||||
if that.LongCache != nil {
|
||||
that.Map = that.LongCache.Cache(HEAD_SESSION_ADD + that.SessionId).ToMap()
|
||||
if that.Map != nil {
|
||||
if that.ShortCache != nil {
|
||||
that.ShortCache.Cache(HEAD_SESSION_ADD+that.SessionId, that.Map)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
this.Map = Map{}
|
||||
this.ShortCache.Cache(HEAD_SESSION_ADD+this.SessionId, this.Map)
|
||||
that.Map = Map{}
|
||||
that.ShortCache.Cache(HEAD_SESSION_ADD+that.SessionId, that.Map)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *SessionIns) Init(short CacheIns, long CacheIns) {
|
||||
this.ShortCache = short
|
||||
this.LongCache = long
|
||||
func (that *SessionIns) Init(short CacheIns, long CacheIns) {
|
||||
that.ShortCache = short
|
||||
that.LongCache = long
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user