You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
936 B
46 lines
936 B
// Code generated by $GOPATH/src/go-common/app/tool/cache/gen. DO NOT EDIT. |
|
|
|
/* |
|
Package kfc is a generated cache proxy package. |
|
It is generated from: |
|
type _cache interface { |
|
// cache: -sync=true |
|
KfcCoupon(c context.Context, id int64) (*kfc.BnjKfcCoupon, error) |
|
} |
|
*/ |
|
|
|
package kfc |
|
|
|
import ( |
|
"context" |
|
|
|
"go-common/app/interface/main/activity/model/kfc" |
|
"go-common/library/stat/prom" |
|
) |
|
|
|
var _ _cache |
|
|
|
// KfcCoupon get data from cache if miss will call source method, then add to cache. |
|
func (d *Dao) KfcCoupon(c context.Context, id int64) (res *kfc.BnjKfcCoupon, err error) { |
|
addCache := true |
|
res, err = d.CacheKfcCoupon(c, id) |
|
if err != nil { |
|
addCache = false |
|
err = nil |
|
} |
|
if res != nil { |
|
prom.CacheHit.Incr("KfcCoupon") |
|
return |
|
} |
|
prom.CacheMiss.Incr("KfcCoupon") |
|
res, err = d.RawKfcCoupon(c, id) |
|
if err != nil { |
|
return |
|
} |
|
miss := res |
|
if !addCache { |
|
return |
|
} |
|
d.AddCacheKfcCoupon(c, id, miss) |
|
return |
|
}
|
|
|