Skip to content

Conversation

@FelixVaughan
Copy link
Contributor

@FelixVaughan FelixVaughan commented May 15, 2025

This relates to...

This is addressing #4185

Rationale

Currently it's possible to configure a maxSize with MemoryCacheStore, but there isn't a way to detect when this max size has been exceeded.

Changes

Added methods to get size of a memory cache, and check whether it is overflowing as well as an event which is emitted when the cache is full. Also added tests and updated docs.

Features

  1. Added size getter on MemoryCacheStore
  2. Added isFull public method on MemoryCacheStore
  3. Added maxSizeExceeded event on MemoryCacheStore

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

@FelixVaughan FelixVaughan changed the title Initial impl Add ability to detect when MemoryCacheStore reaches max size May 15, 2025
@@ -0,0 +1,123 @@
'use strict'
Copy link
Member

Choose a reason for hiding this comment

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

can you please move this test together to the others of the cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I moved them to memory-cache-store-tests.js. Let me know if you had somewhere else in mind.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit a8d280c into nodejs:main May 20, 2025
29 of 31 checks passed
@github-actions github-actions bot mentioned this pull request May 20, 2025
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.

2 participants