fix: address code review findings
This commit is contained in:
12
internal/cache/store.go
vendored
12
internal/cache/store.go
vendored
@@ -106,12 +106,16 @@ func sanitizeKeyComponent(s string) string {
|
||||
}
|
||||
|
||||
func keyString(k *CacheKey) string {
|
||||
switch k.Kind {
|
||||
case "city":
|
||||
switch {
|
||||
case strings.HasPrefix(k.Kind, "prefs:saved_city:"):
|
||||
return fmt.Sprintf("prefs:saved_city:%s", sanitizeKeyComponent(k.Code))
|
||||
case strings.HasPrefix(k.Kind, "prefs:search_history:"):
|
||||
return fmt.Sprintf("prefs:search_history:%s", sanitizeKeyComponent(k.Code))
|
||||
case k.Kind == "city":
|
||||
return fmt.Sprintf("cities:%s", sanitizeKeyComponent(k.Code))
|
||||
case "station":
|
||||
case k.Kind == "station":
|
||||
return fmt.Sprintf("stations:%s", sanitizeKeyComponent(k.Code))
|
||||
case "search":
|
||||
case k.Kind == "search":
|
||||
return fmt.Sprintf("search:%s:%s:%s",
|
||||
sanitizeKeyComponent(k.From),
|
||||
sanitizeKeyComponent(k.To),
|
||||
|
||||
Reference in New Issue
Block a user