Shopify/cacheable — pull request #5 by boourns (2013-03-08 23:42:26+00:00)
Title: Remember when a request has captured the lock

@burke @hornairs Please review

If, halfway through a cache refill, an exception is raised and caught to render something else (for example a public-facing 404 page) that is also cacheable, we will attempt to acquire the cacheable lock multiple times in the same request.

The first time will capture the lock, and the second time will fail, think that someone else is rendering the page, and return the unversioned copy to the end-user.

This PR memoizes when the lock is acquired so that the request with the lock will render to completion.

Net effect was if we cached a page, changed it's handle, then tried to access the same page again, the second attempt to get the lock would fail and the old copy would be served as a (recent) response from cache.