Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files stored in cache even if cache is disabled #35

Open
dobesv opened this issue Nov 2, 2011 · 0 comments
Open

Files stored in cache even if cache is disabled #35

dobesv opened this issue Nov 2, 2011 · 0 comments

Comments

@dobesv
Copy link
Contributor

dobesv commented Nov 2, 2011

There's a piece of code:

        this.stream(pathname, files, new(buffer.Buffer)(stat.size), res, function (e, buffer) {
            if (e) { return finish(500, {}) }
            exports.store[key] = {
                stat:      stat,
                buffer:    buffer,
                timestamp: Date.now()
            };
            finish(status, headers);
        });

It should have an if(that.cache) in there to check if the cache is enabled, otherwise the data stored in the cache will never be retrieved and it's just wasting memory. If someone had a lot of static files they would not be happy about all that wasted memory!

Of course as someone pointed out in another ticket, there's a case to be made for eliminating the in-memory cache altogether as reading static files as the OS generally does this caching for you. Caches are more useful for dynamically generated data. Eliminating the in-memory cache would also fix this issue.

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

No branches or pull requests

1 participant