This commit is contained in:
Lunny Xiao 2018-09-21 22:03:04 +08:00
parent c16ca27799
commit 01ab8819c7
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 3 additions and 1 deletions

View File

@ -68,6 +68,7 @@ func (session *Session) get(bean interface{}) (bool, error) {
}
}
var enableContextCache = session.statement.enableContextCache
if session.context != nil {
res := session.context.Value(fmt.Sprintf("%v-%v", sqlStr, args))
if res != nil {
@ -83,7 +84,8 @@ func (session *Session) get(bean interface{}) (bool, error) {
if err != nil || !has {
return has, err
}
if session.statement.enableContextCache {
if enableContextCache {
if session.context == nil {
session.context = context.Background()
}