From caabcea51291d5483491e77835a0a22d999ad7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=86=9B?= <995672751@qq.com> Date: Tue, 9 Jun 2020 17:34:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96key=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化key命名规则,防止字段值互相覆盖 --- service/cache_service/tag.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/cache_service/tag.go b/service/cache_service/tag.go index 8f222e56..66b87b6c 100644 --- a/service/cache_service/tag.go +++ b/service/cache_service/tag.go @@ -23,16 +23,16 @@ func (t *Tag) GetTagsKey() string { } if t.Name != "" { - keys = append(keys, t.Name) + keys = append(keys, "name_" + t.Name) } if t.State >= 0 { - keys = append(keys, strconv.Itoa(t.State)) + keys = append(keys, "state_" + strconv.Itoa(t.State)) } if t.PageNum > 0 { - keys = append(keys, strconv.Itoa(t.PageNum)) + keys = append(keys, "pagenum_" + strconv.Itoa(t.PageNum)) } if t.PageSize > 0 { - keys = append(keys, strconv.Itoa(t.PageSize)) + keys = append(keys, "pagesize_" + strconv.Itoa(t.PageSize)) } return strings.Join(keys, "_")