Skip to content

cache: update MemoryCacheStore default limits #4292

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

Merged
merged 4 commits into from
Jun 26, 2025

Conversation

mcollina
Copy link
Member

@mcollina mcollina commented Jun 25, 2025

Summary

  • Changed MemoryCacheStore default maxCount from Infinity to 1024 entries
  • Changed default maxSize from Infinity to 100MB (104857600 bytes)
  • Changed default maxEntrySize from Infinity to 5MB (5242880 bytes)
  • Updated documentation in CacheStore.md to reflect new defaults
  • Added test to verify default values are correctly applied

Test plan

  • Existing cache store tests continue to pass
  • New test verifies default values are correctly set
  • Documentation updated to reflect changes
  • Linting passes

🤖 Generated with Claude Code

Fixes #4208

Change default values from Infinity to practical limits:
- maxCount: 1024 entries (was Infinity)
- maxSize: 100MB (was Infinity)
- maxEntrySize: 5MB (was Infinity)

Updated documentation and added tests to verify defaults.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Replace ineffective test with meaningful tests that verify:
- maxCount default (1024) prevents unlimited entries
- maxEntrySize default (5MB) rejects large entries

These tests actually validate the memory leak prevention
behavior similar to the test.mjs example.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina requested a review from metcoder95 June 25, 2025 22:44
Copy link
Member

@metcoder95 metcoder95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems CI is not happy

nvm, these are websocket errors, not related to the PR

@mcollina mcollina merged commit 21fc5f1 into main Jun 26, 2025
35 of 37 checks passed
@mcollina mcollina deleted the update-memory-cache-store-defaults branch June 26, 2025 20:50
@github-actions github-actions bot mentioned this pull request Jun 26, 2025
Uzlopak pushed a commit that referenced this pull request Jun 27, 2025
* cache: update MemoryCacheStore default limits

Change default values from Infinity to practical limits:
- maxCount: 1024 entries (was Infinity)
- maxSize: 100MB (was Infinity)
- maxEntrySize: 5MB (was Infinity)

Updated documentation and added tests to verify defaults.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>

* test: improve MemoryCacheStore default limits tests

Replace ineffective test with meaningful tests that verify:
- maxCount default (1024) prevents unlimited entries
- maxEntrySize default (5MB) rejects large entries

These tests actually validate the memory leak prevention
behavior similar to the test.mjs example.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>

---------

Signed-off-by: Matteo Collina <hello@matteocollina.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stale-while-revalidate causing memory leak with cache interceptor
2 participants