Skip to content

Commit

Permalink
region cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSen-qn committed Apr 19, 2024
1 parent 6ba9b54 commit dc8b2e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion storage/region_uc_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package storage

import (
"context"
"crypto/md5"
"encoding/json"
"fmt"
"os"
Expand Down Expand Up @@ -318,5 +319,5 @@ func getRegionByV2(ak, bucket string, options UCApiOptions) (*Region, error) {

func makeRegionCacheKey(ak, bucket string, ucHosts []string) string {
hostStrings := fmt.Sprintf("%v", ucHosts)
return fmt.Sprintf("%s:%s:%x", ak, bucket, hostStrings)
return fmt.Sprintf("%s:%s:%x", ak, bucket, md5.Sum([]byte(hostStrings)))
}

0 comments on commit dc8b2e1

Please sign in to comment.