fix: address code review findings
This commit is contained in:
@@ -29,8 +29,12 @@ func NewSearchCacheService(cacheStore cache.Cache, yclient *yandex.Client, m *me
|
||||
// SearchWithCache performs a route search with caching support.
|
||||
// It uses the cache-aside pattern: try cache first, then Yandex API, then write back to cache.
|
||||
func (s *SearchCacheService) SearchWithCache(ctx context.Context, from, to, date string, opts SearchOptions) (*yandex.Response, error) {
|
||||
// Generate cache key
|
||||
searchKey := cache.GetSearchKey(from, to, date)
|
||||
// Generate cache key including far-term flag to distinguish near-term vs far-term searches
|
||||
farTermFlag := "near"
|
||||
if opts.FarTerm {
|
||||
farTermFlag = "far"
|
||||
}
|
||||
searchKey := cache.GetSearchKeyWithFarTerm(from, to, date, farTermFlag)
|
||||
|
||||
// Try to get from cache first
|
||||
fetchFunc := func() ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user