aspnet / live.asp.net

Code for live.asp.net, which hosts the ASP.NET Community Stand-up
https://live.asp.net/
MIT License
289 stars 114 forks source link

Is pre-caching static files a good idea? #143

Closed Neme12 closed 6 years ago

Neme12 commented 7 years ago

Before running the app, CachedWebRootFileProvider.PrimeCache forces cache on all files inside wwwroot. Many of these files are non-minified and never get served in production (bootstrap.css, jquery.js), needlessly taking up hundreds of kilobytes in memory.

The cache itself didn't like that and didn't want to cooperate until it was forced to by setting CompactOnMemoryPressure = false. Maybe this wouldn't even be necessary if it only cached things that are actually needed? Also, if this is a problem for dev environment, caching could only be enabled in production.