Closed schetnikovich closed 8 years ago
This is not fully documented, but you can configure the cache differently for each environment by specifying a cacheProfile
in your config:
var cacheProfile = process.env.NODE_ENV === 'production' ? 'production' : 'development';
require('lasso').configure({
cacheProfile: cacheProfile
});
Here's how the production
cache profile impacts caching: https://github.com/lasso-js/lasso/blob/402c4b01dcaeb20a92d703e2bfab983ff18be01b/lib/LassoCache.js#L14-L55
You'll notice that with the production cache profile the final output of lasso is persisted to disk so that it will be very fast on server restart.
Sorry for the lack of documentation :/ Please let me know if that works for you. We need to update the docs.
@patrick-steele-idem It works like a breeze 🚀
We need to update the docs.
Actually, I think you need to write a book :) It is astonishing how much did you covered by numerous open source projects integrated to the whole system. How this is possible? :) Most of us simply don't understand the scope of functionality, that is possible to do with Lasso + Marko + Marko Widgets.
Please guide me if I missed something, but it seems that page cache invalidates after each restart of node server. This leads to long waiting times for the first user.
While investigating this problem, I enabled logging for
lasso/perf
logger in the following way:Each time I restart node server, I see the following when I visit page for the first time:
Subsequent requests to the same page are instantaneous. My page template looks like this (attributes like
package-path
,cache-key
andname
are not used because they already have sane defaults) :I also tried different lasso configurations: enabling or disabling bundling, minifying or fingerprinting — the same result.
Did I missed some configuration option?
Thank you!
Environment: