app-cloudep-product-service/pkg/domain/redis.go

24 lines
409 B
Go
Raw Normal View History

2025-03-17 02:08:22 +00:00
package domain
import "strings"
type RedisKey string
func (key RedisKey) ToString() string {
return "product:" + string(key)
}
func (key RedisKey) With(s ...string) RedisKey {
parts := append([]string{string(key)}, s...)
return RedisKey(strings.Join(parts, ":"))
}
const (
GetProductRedisKey RedisKey = "get"
)
func GetProductRK(id string) string {
return GetProductRedisKey.With(id).ToString()
}