janl / mustache.js

Minimal templating with {{mustaches}} in JavaScript

Home Page:https://mustache.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Issue:Cache] OUT OF MEMORY

xr0master opened this issue · comments

Introduction:
Added this package to my server, in 2 days - out of memory. Spent a few days to understand why this is happening and the reason is the caching mechanism of mustache.js.
Questions:
Why does it have no limit? Or rotation?
Why did it use in the render? The script no longer uses that cached token.
Why does this just exist? Any developer can do it himself.
How to solve:
Call the clearCache method each time your server is done with the request.

I really like this package, but it requires a redesign.

Thanks for your input.

This package is deliberately not tied to server requests or have sophisticated caching mechanism. As put in the README:

It can be used for HTML, config files, source code - anything.

If proper template caching between server requests and whatnot is what you need, then this package alone won't cut it. I'd recommend having a look at something like consolidate.js or similar that's actually tied to a server somehow.

What does the server and its mechanisms? As put in the README: It can be used for ... anything.

Your code has a memory leak; it doesn't matter where you are going to use it. If your solution to this issue is simply to close it, then you are right.

Thought you might be interesting in the most recent release;

v4.0.0 allows the caching strategy to be overridden. It could either be disabled completely or you could write & provide a better strategy yourself.

Have fun.