Sub Second Caching


I would like to be able to specify a TTL of 0.5 seconds for a specific cache condition.

The web user interface will only accept an integer for “Edit Cache Settings >> TTL”

Is it possible to configure sub-second TTL’s directly in VCL?



@rich subsecond caching isn’t supported, but what are you attempting to do? There may be other configurations options for handling your request pattern other than a .5s TTL.


I would like to cache “ebay” like auction countdown responses. Requests are initiated by a client every second and update a user interface with time remaining and price. I have implemented a cache setting with a TTL of 1 second, which as is probably expected, mostly results in the timer staggering down in 2 second increments. I do not want to change the current design or implementation. I was hoping to bolt on caching in front of it. Any suggestions?


I’l have to keep thinking, but your end goals describes something that’s almost inherently non-cacheable for practical purposes.

If your primary concern is eliminating the “thundering herd” problem of a large cluster of users requesting the same objects at the same time, our request collapsing functionality will work even if you don’t cache. If you set requests to have a 0s TTL or to Pass in a Cache Setting in our UI (or with logic in vcl_fetch if you’re writing VCL), this should be set up properly.


I know you suggested you wouldn’t want to change the implementation, but having built an auction site in the past – I relied upon some (very trivial) JavaScript for the live countdown, the HTML output was cached with a timestamp e.g. “This auction finishes at 10:32 on Friday 3rd of January”, then the JavaScript would transform that into a live countdown. Would this solution be inappropriate here?


Small amendment to @aspires 's post, setting a 0 TTL would work to keep out the thundering herd, but using a pass request or cache setting would not.