Enlive already performs some caching on static parts of the template (and will do more as soon as I get enough time in a row to work on it). Lau's way of handling login/logout is rather unusual and goes against the grain of Enlive: he puts html in program code! A way to do that in enlive is to put both login form and logout text in the html template and then to make Enlive remove the one which doesn't apply.