

def _cached_func(self, *args, **kwargs):
    cb = kwargs.get(self.cbname)
    key = self.cache_key_method(*args, **kwargs)
    if (key in self.cache):
        (cached_result, exp_time) = self.cache[key]
        if (exp_time > datetime.now()):
            cb(cached_result)
            return
    kwargs[self.cbname] = self._caching_callback(key, cb)
    self.func(*args, **kwargs)

dataset/ETHPy150Open truemped/tornadotools/tornadotools/caching.py Cache._cached_func/original