Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flat-cache - removing console.log remnant #935

Merged
merged 3 commits into from
Dec 11, 2024
Merged
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
8 changes: 4 additions & 4 deletions packages/cache-manager/test/wrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('wrap with multi-layer stores', () => {
expect(await keyv2.get(data.key)).toEqual(0);

// Sleep 501ms, trigger keyv1 refresh
await sleep(501);
await sleep(550);

// Background refresh, but stale value returned, while keyv1 and keyv2 are all updated
expect(await cache.wrap(data.key, async () => 1)).toEqual(0);
Expand All @@ -173,7 +173,7 @@ describe('wrap with multi-layer stores', () => {
expect(await keyv2.get(data.key)).toEqual(1);

// Sleep 1001ms, keyv1 expired, but keyv2 was refreshed before, so keyv2 will not be refreshed, write back to keyv1 directly
await sleep(1001);
await sleep(1050);

expect(await keyv1.get(data.key)).toBeUndefined();
expect(await keyv2.get(data.key)).toEqual(1);
Expand All @@ -183,8 +183,8 @@ describe('wrap with multi-layer stores', () => {
expect(await keyv1.get(data.key)).toEqual(1);
expect(await keyv2.get(data.key)).toEqual(1);

// Sleep 801ms, keyv1 expired, trigger keyv2 refresh
await sleep(801);
// Sleep 850ms, keyv1 expired, trigger keyv2 refresh
await sleep(850);

expect(await keyv1.get(data.key)).toBeUndefined();
expect(await keyv2.get(data.key)).toEqual(1);
Expand Down
4 changes: 2 additions & 2 deletions packages/cacheable/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,12 @@ describe('cacheable ttl parsing', async () => {
});

test('setMany without ttl', async () => {
const cacheable = new Cacheable({ttl: 2});
const cacheable = new Cacheable({ttl: 50});
const list = [{key: 'key1', value: 'value1'}, {key: 'key2', value: 'value2'}];
await cacheable.setMany(list);
const firstResult = await cacheable.getMany(['key1', 'key2']);
expect(firstResult).toEqual(['value1', 'value2']);
await sleep(5);
await sleep(100);
const result = await cacheable.getMany(['key1', 'key2']);
expect(result).toEqual([undefined, undefined]);
});
Expand Down
1 change: 0 additions & 1 deletion packages/flat-cache/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export class FlatCache extends Hookified {
const items = this._parse(data);
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
for (const key of Object.keys(items)) {
console.log('key', items[key]);
this._cache.set(items[key].key as string, items[key].value, {expire: items[key].expires as number});
}

Expand Down
Loading