.. _tutorial-advanced_topics: Advanced topics --------------- This tutorial has covered the basics in Varnish. If you read through it all you should now have the skills to run Varnish. Here is a short overview of topics that we haven't covered in the tutorial. More VCL ~~~~~~~~ VCL is a bit more complex then what we've covered so far. There are a few more subroutines available and there a few actions that we haven't discussed. For a complete(ish) guide to VCL have a look at the VCL man page - ref:`reference-vcl`. Using In-line C to extend Varnish ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can use *in-line C* to extend Varnish. Please note that you can seriously mess up Varnish this way. The C code runs within the Varnish Cache process so if your code generates a segfault the cache will crash. One of the first uses I saw of In-line C was logging to syslog.:: # The include statements must be outside the subroutines. C{ #include }C sub vcl_something { C{ syslog(LOG_INFO, "Something happened at VCL line XX."); }C } Edge Side Includes ~~~~~~~~~~~~~~~~~~ Varnish can cache create web pages by putting different pages together. These *fragments* can have individual cache policies. If you have a web site with a list showing the 5 most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages. Used properly it can dramatically increase your hit rate and reduce the load on your servers. ESI looks like this:: The time is: at this very moment. ESI is processed in vcl_fetch by setting *do_esi* to true.:: sub vcl_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ } }