Skip to content

Cacheable - feat: upgrading cacheable memory to use hash for map stores#1126

Merged
jaredwray merged 22 commits intomainfrom
cacheable---upgrading-CacheableMemory-to-use-hash-for-Map-stores
Jun 7, 2025
Merged

Cacheable - feat: upgrading cacheable memory to use hash for map stores#1126
jaredwray merged 22 commits intomainfrom
cacheable---upgrading-CacheableMemory-to-use-hash-for-Map-stores

Conversation

@jaredwray
Copy link
Copy Markdown
Owner

@jaredwray jaredwray commented May 22, 2025

Please check if the PR fulfills these requirements

  • Followed the Contributing guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Cacheable - feat: upgrading cacheable memory to use hash for map stores

	test('should be able to go past 17mm with hash enabled and no LRU', () => {
		const cache = new CacheableMemory({lruSize: 0});
		for (let i = 0; i < 18_000_000; i++) {
			cache.set(`key${i}`, `value${i}`);
		}

		expect(cache.size).toBe(18_000_000);
	});

@PaulAnnekov
Copy link
Copy Markdown

@jaredwray looks like lruSize is per-store. And the amount of stores dynamically increases, which makes no sense in lruSize property. Am I correct?

@jaredwray
Copy link
Copy Markdown
Owner Author

@jaredwray looks like lruSize is per-store. And the amount of stores dynamically increases, which makes no sense in lruSize property. Am I correct?

As I have said in the past. No matter how many stores you have lru is controlled by a single Map as a DoubleLinkedList so it will always limit to 17mm.

@jaredwray jaredwray merged commit f36e3ad into main Jun 7, 2025
6 checks passed
@jaredwray jaredwray deleted the cacheable---upgrading-CacheableMemory-to-use-hash-for-Map-stores branch June 7, 2025 17:18
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