This week at work I was able to get our Varnish caching working while still being able to bucket users into AB tests and set cookies on the server. Normally Varnish won’t cache the page if a cookie is set server-side but with the use of esi:include tags it’s possible to get cookies and cache. This was very little code but took a lot of brain power to wrap my head around how it works.

The gist of it is that when Varnish forwards a request to the server, the server can hand back a simple esi:include tag with a src attribute pointing to a resource. And if Varnish already has that resource cached it will use it instead of requesting it from the server. So on every request, we can bucket a user into a test and set a cookie, and Varnish retains the ability to cache the actual content of the page.

We launch the test of this next week, so we’ll see how it goes. But we have many use cases for this, so it was fun to finally figure it out.

And now I am jamming on a little programming puzzle for a “code kata” meetup at work. We are working on this anagrams code kata. I wrote a quick sketch in JavaScript then chose to write a solution in Racket. I think I have a good solution and I really enjoyed Racket! I’m getting more comfortable with Lisp and I think my brain works well with it. Small functions, small abstractions building into a bigger program.

Fun times learning new things, solving problems.

Posted June 24, 2017 | | File under: ,

Kind of obsessed with Lisp at the moment. Reading “Structure and Interpretation of Computer Programs” now and I’m about to start “Land of Lisp”.

Like many that study Lisp, I think, I’m learning Lisp no so much to know Lisp better but to know programming better, in general. Though Lisp is lovely.

Posted February 2, 2014 | | File under: ,

bionicbrian.com | About

Creative Commons License