附近小店
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.

redis.go 953 B

2 months ago
1234567891011121314151617181920212223242526272829303132
  1. package utils
  2. import (
  3. "applet/app/utils/cache"
  4. "fmt"
  5. "github.com/gin-gonic/gin"
  6. )
  7. func ClearRedis(c *gin.Context) {
  8. var str = []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
  9. key := fmt.Sprintf("%s:cfg_cache", c.GetString("mid"))
  10. cache.Del(key)
  11. key2 := fmt.Sprintf("%s:virtual_coin_cfg", c.GetString("mid"))
  12. cache.Del(key2)
  13. for _, v := range str {
  14. key1 := fmt.Sprintf("%s:cfg_cache:%s", c.GetString("mid"), v)
  15. cache.Del(key1)
  16. }
  17. }
  18. func ClearRedisDb(dbname string) {
  19. var str = []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
  20. key := fmt.Sprintf("%s:cfg_cache", dbname)
  21. cache.Del(key)
  22. key2 := fmt.Sprintf("%s:virtual_coin_cfg", dbname)
  23. cache.Del(key2)
  24. for _, v := range str {
  25. key1 := fmt.Sprintf("%s:cfg_cache:%s", dbname, v)
  26. cache.Del(key1)
  27. }
  28. }