Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugins/response-cache-redis/src/redis-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const createRedisCache = (params: RedisCacheParameter): Cache => {
pipeline.set(responseId, JSON.stringify(result));
} else {
// set the ttl in milliseconds
pipeline.set(responseId, JSON.stringify(result), 'PX', ttl);
pipeline.set(responseId, JSON.stringify(result), 'EX', ttl);
}

const responseKey = buildRedisOperationResultCacheKey(responseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ describeIf(versionInfo.major >= 16)('useResponseCache with Redis cache', () => {
// so queried just once
expect(spy).toHaveBeenCalledTimes(1);

// let's travel in time beyond the ttl of 100
jest.advanceTimersByTime(150);
// let's travel in time beyond the ttl of 100 seconds
jest.advanceTimersByTime(150_000);

// since the cache has expired, now when we query
await testInstance.execute(query);
Expand Down Expand Up @@ -1083,8 +1083,8 @@ describeIf(versionInfo.major >= 16)('useResponseCache with Redis cache', () => {
await testInstance.execute(query);
expect(spy).toHaveBeenCalledTimes(1);

// wait so User expires
jest.advanceTimersByTime(201);
// wait so User expires, beyond 200 seconds
jest.advanceTimersByTime(201_000);

await testInstance.execute(query);
// now we've queried twice
Expand Down Expand Up @@ -1174,8 +1174,8 @@ describeIf(versionInfo.major >= 16)('useResponseCache with Redis cache', () => {
await testInstance.execute(query);
expect(spy).toHaveBeenCalledTimes(1);

// wait so User expires
jest.advanceTimersByTime(201);
// wait so User expires beyond 200 seconds
jest.advanceTimersByTime(201_000);

await testInstance.execute(query);
// now we've queried twice
Expand Down