Closed sungam3r closed 1 year ago
It looks like a nice win; normally we view unbounded cache growth as a bug; I can see how in this case it'd generally indicate misuse by a caller, but elsewhere (e.g. MessageTemplateCache
) we've hardened up the code against this kind of problem.
(For example, since the log message may be some generated string, it's not impossible to imagine the generated string erroneously including "{$some-guid}
and filling the cache with garbage.)
Is there a cheap way to limit the cache size? Perhaps since $
(stringify) is rarely used, we could not do the caching there, and for @
(capture) we could first check the cache size and fall through to the substring operation if we see > 1000 entries?
I'd use cache for both cases. Ok with limiting size.
Done
Looks great 👍
before
after