node-mysql2 icon indicating copy to clipboard operation
node-mysql2 copied to clipboard

[bug][regression] mysql2.setMaxParserCache fails with TypeError

Open constb opened this issue 8 months ago • 4 comments

Hi!

If I call setMaxParserCache imported from mysql2, I get an error:

<snip>/node_modules/mysql2/lib/parsers/parser_cache.js:54
  parserCache.max = max;
                  ^
TypeError: Cannot set property max of #<LRUCache> which has only a getter

I really need to downsize this cache because it always ends up being full and consuming about 300Mb RAM. Probably something about my use case that makes it grow so big…

I believe somewhere along the way lru-cache changed its internals and cannot be resized anymore. I'd like if setMaxParserCache would throw away an old cache and create a new one with right size in its place…

constb avatar Jun 10 '24 08:06 constb