def get_data(self, *args, **kwargs): cache_key = get_cache_key( self.data_provider.func_name, *args, **kwargs ) cache = get_cache( self.data_provider.async_report_cache_alias, ) data = cache.get(cache_key) if data is not None: return None if data == 'in progress' else data cache.set( cache_key, 'in progress', self.data_provider.async_report_results_expiration, ) queue = django_rq.get_queue( name='reports' if 'reports' in settings.RQ_QUEUES else 'default', ) queue.enqueue_call( func='%s.%s' % ( self.data_provider.__module__, self.data_provider.func_name, ), args=args, kwargs=kwargs, timeout=3600, result_ttl=0, )
def invalidate_data(self, *args, **kwargs): cache_key = get_cache_key(self.data_provider.func_name, *args, **kwargs) cache = get_cache(self.data_provider.async_report_cache_alias, ) data = cache.get(cache_key) if data is None or data == 'in progress': return cache.delete(cache_key)
def invalidate_data(self, *args, **kwargs): cache_key = get_cache_key( self.data_provider.func_name, *args, **kwargs ) cache = get_cache( self.data_provider.async_report_cache_alias, ) data = cache.get(cache_key) if data is None or data == 'in progress': return cache.delete(cache_key)
def get_data(self, *args, **kwargs): cache_key = get_cache_key(self.data_provider.func_name, *args, **kwargs) cache = get_cache(self.data_provider.async_report_cache_alias, ) data = cache.get(cache_key) if data is not None: return None if data == 'in progress' else data cache.set( cache_key, 'in progress', self.data_provider.async_report_results_expiration, ) queue = django_rq.get_queue( name='reports' if 'reports' in settings.RQ_QUEUES else 'default', ) queue.enqueue_call( func='%s.%s' % ( self.data_provider.__module__, self.data_provider.func_name, ), args=args, kwargs=kwargs, timeout=3600, result_ttl=0, )