Skip to content

Commit

Permalink
fix(redis 4 adapter): ceil EXAT value #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
TapaiBalazs authored Dec 14, 2022
1 parent adce823 commit 58f0602
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function redisCacheAdapter(redisCache: RedisLikeCache): Cache {
JSON.stringify(value),
ttl > 0 && ttl < Infinity && typeof createdTime === 'number'
? {
EXAT: (ttl + createdTime) / 1000,
EXAT: Math.ceil((ttl + createdTime) / 1000),
}
: undefined,
);
Expand Down
2 changes: 1 addition & 1 deletion src/cachified.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ describe('cachified', () => {
metadata: { ttl: 1, swr: 0, createdTime: 0 },
value: 'FOUR',
}),
{ EXAT: 0.001 },
{ EXAT: 1 },
);

await cache.set('lel', undefined as any);
Expand Down

0 comments on commit 58f0602

Please sign in to comment.