(c *gin.Context)
| 19 | } |
| 20 | |
| 21 | func ClearChannelAffinityCache(c *gin.Context) { |
| 22 | all := strings.TrimSpace(c.Query("all")) |
| 23 | ruleName := strings.TrimSpace(c.Query("rule_name")) |
| 24 | |
| 25 | if all == "true" { |
| 26 | deleted := service.ClearChannelAffinityCacheAll() |
| 27 | c.JSON(http.StatusOK, gin.H{ |
| 28 | "success": true, |
| 29 | "message": "", |
| 30 | "data": gin.H{ |
| 31 | "deleted": deleted, |
| 32 | }, |
| 33 | }) |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | if ruleName == "" { |
| 38 | common.ApiErrorStatus(c, http.StatusBadRequest, common.NewMessage("Missing parameter rule_name, or use all=true to clear everything")) |
| 39 | return |
| 40 | } |
| 41 | |
| 42 | deleted, err := service.ClearChannelAffinityCacheByRuleName(ruleName) |
| 43 | if err != nil { |
| 44 | common.ApiErrorStatus(c, http.StatusBadRequest, err) |
| 45 | return |
| 46 | } |
| 47 | |
| 48 | c.JSON(http.StatusOK, gin.H{ |
| 49 | "success": true, |
| 50 | "message": "", |
| 51 | "data": gin.H{ |
| 52 | "deleted": deleted, |
| 53 | }, |
| 54 | }) |
| 55 | } |
| 56 | |
| 57 | func GetChannelAffinityUsageCacheStats(c *gin.Context) { |
| 58 | ruleName := strings.TrimSpace(c.Query("rule_name")) |
nothing calls this directly
no test coverage detected