redis.go 793 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package pendant
  2. import (
  3. "context"
  4. "strconv"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _pendantPKG = "pkg_" // key of
  9. _pendantEquip = "pe_"
  10. )
  11. // DelPKGCache del package cache
  12. func (d *Dao) DelPKGCache(c context.Context, mid int64) (err error) {
  13. key := _pendantPKG + strconv.FormatInt(mid, 10)
  14. conn := d.redis.Get(c)
  15. defer conn.Close()
  16. if err = conn.Send("DEL", key); err != nil {
  17. log.Error("conn.Send(DEL, %s) error(%v)", key, err)
  18. return
  19. }
  20. return
  21. }
  22. // DelEquipCache set pendant info cache
  23. func (d *Dao) DelEquipCache(c context.Context, mid int64) (err error) {
  24. key := _pendantEquip + strconv.FormatInt(mid, 10)
  25. conn := d.redis.Get(c)
  26. defer conn.Close()
  27. if err = conn.Send("DEL", key); err != nil {
  28. log.Error("conn.Send(DEL, %s) error(%v)", key, err)
  29. return
  30. }
  31. return
  32. }