

def get(self, *raw_args, **raw_kwargs):
    '\n        Return the data for this function (using the cache if possible).\n\n        This method is not intended to be overidden\n        '
    args = self.prepare_args(*raw_args)
    kwargs = self.prepare_kwargs(**raw_kwargs)
    key = self.key(*args, **kwargs)
    item = self.cache.get(key)
    call = Call(args=raw_args, kwargs=raw_kwargs)
    if (item is None):
        if self.should_missing_item_be_fetched_synchronously(*args, **kwargs):
            logger.debug("Job %s with key '%s' - cache MISS - running synchronous refresh", self.class_path, key)
            result = self.refresh(*args, **kwargs)
            return self.process_result(result, call=call, cache_status=self.MISS, sync_fetch=True)
        else:
            logger.debug("Job %s with key '%s' - cache MISS - triggering async refresh and returning empty result", self.class_path, key)
            result = self.empty()
            self.cache_set(timeout, self.timeout(*args, **kwargs), result)
            self.async_refresh(*args, **kwargs)
            return self.process_result(result, call=call, cache_status=self.MISS, sync_fetch=False)
    (expiry, data) = item
    delta = (time.time() - expiry)
    if (delta > 0):
        if self.should_stale_item_be_fetched_synchronously(delta, *args, **kwargs):
            logger.debug("Job %s with key '%s' - STALE cache hit - running synchronous refresh", self.class_path, key)
            result = self.refresh(*args, **kwargs)
            return self.process_result(result, call=call, cache_status=self.STALE, sync_fetch=True)
        else:
            logger.debug("Job %s with key '%s' - STALE cache hit - triggering async refresh and returning stale result", self.class_path, key)
            timeout = self.timeout(*args, **kwargs)
            self.cache_set(key, timeout, data)
            self.async_refresh(*args, **kwargs)
            return self.process_result(data, call=call, cache_status=self.STALE, sync_fetch=False)
    else:
        logger.debug("Job %s with key '%s' - cache HIT", self.class_path, key)
        return self.process_result(data, call=call, cache_status=self.HIT)

dataset/ETHPy150Open codeinthehole/django-cacheback/cacheback/base.py Job.get/VarMisuse@176/325 `key`->`timeout`