I’m setting up some logging and one of the items it would be useful to know is how long it was since the object was last accessed.
Standard VCL has obj.lastuse. The documentation states for this:
obj.lastuse - The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver.
Looking at the actual values given this is an absolute time of last use (eg, 1424204806.674).
In order to try getting a delta I’ve tried various options:
- now - obj.lastuse (Errors with Expected CNUM got ‘obj.lastuse’)
- now.sec - obj.lastuse (Errors with Expected variable, string or semicolon)
- time.sub(now, obj.lastuse) (Errors with Expected a TIME variable)
- time.sub(now.sec, obj.lastuse) (Errors with Expected a TIME variable, but now referencing now.sec)
I’m a bit stumped with this one. It looks like the new time functions expect a time object which is fine. There’s a way to convert a hex string to a time, but I can’t see a way to convert an inteteger to a time.
Any help would be much appreciated here.