I'm working on an AngularJS project that will have considerable traffic.
While in development I'm stumbled upon the issue with partials cached and not updated on different actions. Sure, I can get rid of this using .run with $templateCache.removeAll(); for example, but want to make sure this is actually a good idea.
Some partials are updated dynamically (user input, or automatically in intervals), while some are static or updated very infrequently.
What would be the best approach to caching in this case?
With non-angular sites I prefer to keep responsibilities cleanly split, for ex.: 1. Cache-headers are set on app level 2. nginx - just to serve sites per se 3. Varnish doing FPC + CDN for static assets or CDN doing full page caching (depending on a client/project, etc.) etc. etc. etc. Key point: every part has its own distinct responsibility.
With this project I can use Varnish and CDN for static assets, multi-server setup. Possibility to re-use Varnish for loadbalancing as well, i.e. I may have Varnish above several web-nodes. I have some flexibility in terms of infrastructure.
Please share your thoughts on the optimal setup? In particular: is it still worth caching partials? If yes, what would be the best place to set CC headers? What would be the best way to flush their cache then, esp. if I need to flush only some sub-selection?
Thank you!! D.
答案 0 :(得分:0)
自己发布答案,因为无法选择抢劫回复作为答案。我的解决方案基于他的建议,这对我的前进有很大帮助:
在制作期间:
一些快速说明:
希望这有帮助, 丹尼斯