Skip to content

Commit

Permalink
fix(cache): remove duplicate function for combining into key
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksasiriski committed Oct 21, 2024
1 parent ac328e3 commit bfe447f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
9 changes: 0 additions & 9 deletions src/cache/actions.go

This file was deleted.

3 changes: 2 additions & 1 deletion src/cache/actions_currencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/hearchco/agent/src/exchange/currency"
"github.com/hearchco/agent/src/exchange/engines"
"github.com/hearchco/agent/src/utils/morestrings"
)

func (db DB) SetCurrencies(base currency.Currency, engs []engines.Name, currencies currency.Currencies, ttl ...time.Duration) error {
Expand All @@ -31,5 +32,5 @@ func combineBaseWithExchangeEnginesNames(base currency.Currency, engs []engines.
}

baseWithEnginesNamesStrings := append(enginesNamesStrings, base.String())
return combineIntoKey(baseWithEnginesNamesStrings...)
return morestrings.JoinNonEmpty("", "_", baseWithEnginesNamesStrings...)
}
3 changes: 2 additions & 1 deletion src/cache/actions_results.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hearchco/agent/src/search/category"
"github.com/hearchco/agent/src/search/engines/options"
"github.com/hearchco/agent/src/search/result"
"github.com/hearchco/agent/src/utils/morestrings"
)

func (db DB) SetResults(q string, cat category.Name, opts options.Options, results []result.Result, ttl ...time.Duration) error {
Expand Down Expand Up @@ -44,7 +45,7 @@ func (db DB) GetResultsTTL(q string, cat category.Name, opts options.Options) (t
}

func combineQueryWithOptions(q string, cat category.Name, opts options.Options) string {
return combineIntoKey(
return morestrings.JoinNonEmpty("", "_",
q, cat.String(),
strconv.Itoa(opts.Pages.Start), strconv.Itoa(opts.Pages.Max),
opts.Locale.String(), strconv.FormatBool(opts.SafeSearch),
Expand Down

0 comments on commit bfe447f

Please sign in to comment.