memcache.go 600 B

1234567891011121314151617181920212223242526272829303132
  1. package dao
  2. import (
  3. "context"
  4. "strconv"
  5. gmc "go-common/library/cache/memcache"
  6. "go-common/library/log"
  7. )
  8. const (
  9. _mcnSign = "mcn_s_"
  10. )
  11. // user mcn sign key.
  12. func mcnSignKey(mcnMid int64) string {
  13. return _mcnSign + strconv.FormatInt(mcnMid, 10)
  14. }
  15. // DelMcnSignCache del mcn sign cache info.
  16. func (d *Dao) DelMcnSignCache(c context.Context, mcnMid int64) (err error) {
  17. conn := d.mc.Get(c)
  18. defer conn.Close()
  19. if err = conn.Delete(mcnSignKey(mcnMid)); err != nil {
  20. if err == gmc.ErrNotFound {
  21. err = nil
  22. return
  23. }
  24. log.Error("conn.Delete(%d) error(%v)", mcnMid, err)
  25. }
  26. return
  27. }