// Code generated by $GOPATH/src/go-common/app/tool/cache/mc. DO NOT EDIT. /* Package bnj is a generated mc cache package. It is generated from: type _mc interface { // mc: -key=timeFinishKey CacheTimeFinish(c context.Context) (int64, error) // mc: -key=timeFinishKey DelCacheTimeFinish(c context.Context) (int64, error) // mc: -key=timeLessKey DelCacheTimeLess(c context.Context) (int64, error) } */ package bnj import ( "context" "fmt" "strconv" "go-common/library/cache/memcache" "go-common/library/log" "go-common/library/stat/prom" ) var _ _mc // CacheTimeFinish get data from mc func (d *Dao) CacheTimeFinish(c context.Context) (res int64, err error) { conn := d.mc.Get(c) defer conn.Close() key := timeFinishKey() reply, err := conn.Get(key) if err != nil { if err == memcache.ErrNotFound { err = nil return } prom.BusinessErrCount.Incr("mc:CacheTimeFinish") log.Errorv(c, log.KV("CacheTimeFinish", fmt.Sprintf("%+v", err)), log.KV("key", key)) return } var v string err = conn.Scan(reply, &v) if err != nil { prom.BusinessErrCount.Incr("mc:CacheTimeFinish") log.Errorv(c, log.KV("CacheTimeFinish", fmt.Sprintf("%+v", err)), log.KV("key", key)) return } r, err := strconv.ParseInt(v, 10, 64) if err != nil { prom.BusinessErrCount.Incr("mc:CacheTimeFinish") log.Errorv(c, log.KV("CacheTimeFinish", fmt.Sprintf("%+v", err)), log.KV("key", key)) return } res = int64(r) return } // DelCacheTimeFinish delete data from mc func (d *Dao) DelCacheTimeFinish(c context.Context) (err error) { conn := d.mc.Get(c) defer conn.Close() key := timeFinishKey() if err = conn.Delete(key); err != nil { if err == memcache.ErrNotFound { err = nil return } prom.BusinessErrCount.Incr("mc:DelCacheTimeFinish") log.Errorv(c, log.KV("DelCacheTimeFinish", fmt.Sprintf("%+v", err)), log.KV("key", key)) return } return } // DelCacheTimeLess delete data from mc func (d *Dao) DelCacheTimeLess(c context.Context) (err error) { conn := d.mc.Get(c) defer conn.Close() key := timeLessKey() if err = conn.Delete(key); err != nil { if err == memcache.ErrNotFound { err = nil return } prom.BusinessErrCount.Incr("mc:DelCacheTimeLess") log.Errorv(c, log.KV("DelCacheTimeLess", fmt.Sprintf("%+v", err)), log.KV("key", key)) return } return }