7 """Parse Arvados timestamp to unix time."""
11 return calendar.timegm(ciso8601.parse_datetime_unaware(t).timetuple())
12 except (TypeError, ValueError):
15 def use_counter(orig_func):
16 @functools.wraps(orig_func)
17 def use_counter_wrapper(self, *args, **kwargs):
20 return orig_func(self, *args, **kwargs)
23 return use_counter_wrapper
25 class FreshBase(object):
26 """Base class for maintaining fresh/stale state to determine when to update."""
30 self._last_update = time.time()
31 self._atime = time.time()
36 self.cache_priority = None
38 self.cache_uuid = None
40 # Mark the value as stale
44 # Test if the entries dict is stale.
49 return (self._last_update + self._poll_time) < self._atime
54 self._last_update = time.time()
62 def clear(self, force=False):
66 return self.use_count > 0