Make sure to only write to cache when needed
This commit is contained in:
parent
ecfa35350c
commit
22f67ab4ed
1 changed files with 5 additions and 3 deletions
|
@ -127,9 +127,11 @@ func (o *{{$tableNameSingular}}) Insert(exec boil.Executor, whitelist ... string
|
|||
}
|
||||
{{end}}
|
||||
|
||||
{{$varNameSingular}}InsertCacheMut.Lock()
|
||||
{{$varNameSingular}}InsertCache[key] = cache
|
||||
{{$varNameSingular}}InsertCacheMut.Unlock()
|
||||
if !cached {
|
||||
{{$varNameSingular}}InsertCacheMut.Lock()
|
||||
{{$varNameSingular}}InsertCache[key] = cache
|
||||
{{$varNameSingular}}InsertCacheMut.Unlock()
|
||||
}
|
||||
|
||||
{{if not .NoHooks -}}
|
||||
return o.doAfterInsertHooks(exec)
|
||||
|
|
Loading…
Add table
Reference in a new issue