Skip to content

Commit 9e07b06

Browse files
committed
feat: update cache key generation to use configurable cache version
1 parent 6298114 commit 9e07b06

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

routers/middleware/caching.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,17 @@ func NewCacheService(config config.RedisConfiguration) (*CacheService, error) {
5656
}
5757

5858
func generateCacheKey(c *gin.Context) string {
59-
// conf := config.RedisConfig()
60-
conf := "v1"
59+
conf := config.RedisConfig()
6160
path := c.Request.URL.Path
6261
switch {
6362
case path == "/v1/currencies":
64-
return fmt.Sprintf("%s:api:currencies:list", conf)
63+
return fmt.Sprintf("%s:api:currencies:list", conf.CacheVersion)
6564
case path == "/v1/pubkey":
66-
return fmt.Sprintf("%s:api:aggregator:pubkey", conf)
65+
return fmt.Sprintf("%s:api:aggregator:pubkey", conf.CacheVersion)
6766
case len(c.Param("currency_code")) > 0:
68-
return fmt.Sprintf("%s:api:institutions:%s", conf, c.Param("currency_code"))
67+
return fmt.Sprintf("%s:api:institutions:%s", conf.CacheVersion, c.Param("currency_code"))
6968
default:
70-
return fmt.Sprintf("%s:api:%s", conf, path)
69+
return fmt.Sprintf("%s:api:%s", conf.CacheVersion, path)
7170
}
7271
}
7372

0 commit comments

Comments
 (0)