Skip to content

Commit 5b7cc3c

Browse files
authored
Merge pull request #61 from ethereumfollowprotocol/normalize-cache-key
normalize key
2 parents 5b3a532 + 982cb95 commit 5b7cc3c

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/router/api/v1/lists/buttonState/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function buttonState(lists: Hono<{ Bindings: Environment }>, services: Se
1313
return context.json({ response: 'Invalid list id' }, 400)
1414
}
1515
const cacheService = services.cache(env(context))
16-
const cacheTarget = `lists/${token_id}/${addressOrENS}/buttonState`
16+
const cacheTarget = `lists/${token_id}/${addressOrENS}/buttonState`.toLowerCase()
1717
if (cache !== 'fresh') {
1818
const cacheHit = await cacheService.get(cacheTarget)
1919
if (cacheHit) {

src/router/api/v1/lists/followerState/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function followerState(lists: Hono<{ Bindings: Environment }>, services:
1313
return context.json({ response: 'Invalid list id' }, 400)
1414
}
1515
const cacheService = services.cache(env(context))
16-
const cacheTarget = `lists/${token_id}/${addressOrENS}/followerState`
16+
const cacheTarget = `lists/${token_id}/${addressOrENS}/followerState`.toLowerCase()
1717
if (cache !== 'fresh') {
1818
const cacheHit = await cacheService.get(cacheTarget)
1919
if (cacheHit) {

src/router/api/v1/lists/stats/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function stats(lists: Hono<{ Bindings: Environment }>, services: Services
1313
return context.json({ response: 'Invalid list id' }, 400)
1414
}
1515
const cacheService = services.cache(env(context))
16-
const cacheTarget = `lists/${token_id}/stats`
16+
const cacheTarget = `lists/${token_id}/stats`.toLowerCase()
1717
if (cache !== 'fresh') {
1818
const cacheHit = await cacheService.get(cacheTarget)
1919
if (cacheHit) {

src/router/api/v1/users/followerState/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function followerState(users: Hono<{ Bindings: Environment }>, services:
1111
const { cache } = context.req.query()
1212

1313
const cacheService = services.cache(env(context))
14-
const cacheTarget = `users/${addressOrENS}/${addressOrENS2}/followerState`
14+
const cacheTarget = `users/${addressOrENS}/${addressOrENS2}/followerState`.toLowerCase()
1515
if (cache !== 'fresh') {
1616
const cacheHit = await cacheService.get(cacheTarget)
1717
if (cacheHit) {

src/router/api/v1/users/stats/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export function stats(users: Hono<{ Bindings: Environment }>, services: Services
1212
const { live, cache } = context.req.query()
1313

1414
const cacheService = services.cache(env(context))
15-
const cacheTarget = `users/${addressOrENS}/stats`
16-
if (cache !== 'fresh') {
15+
const cacheTarget = `users/${addressOrENS}/stats`.toLowerCase()
16+
if (cache !== 'fresh' || live !== 'true') {
1717
const cacheHit = await cacheService.get(cacheTarget)
1818
if (cacheHit) {
1919
return context.json({ ...cacheHit }, 200)

0 commit comments

Comments
 (0)