def reset_cache(request): """ Resetts the cache for every test """ if 'django_db' in request.node.keywords or is_django_unittest(request): # When the db is created, use the original cachables element_cache.ensure_cache(reset=True)
def reset_cache(request): """ Resetts the cache for every test """ if 'django_db' in request.node.keywords or is_django_unittest(request): # When the db is created, use the original cachables async_to_sync(element_cache.cache_provider.clear_cache)() element_cache.ensure_cache(reset=True) # Set constant start_time element_cache.start_time = 1
def reset_cache(request): """ Resetts the cache for every test """ if "django_db" in request.node.keywords or is_django_unittest(request): # When the db is created, use the original cachables async_to_sync(element_cache.cache_provider.clear_cache)() element_cache.ensure_cache(reset=True) # Set constant start_time element_cache.start_time = 1
def reset_cache(request): """ Resetts the cache for every test """ if "django_db" in request.node.keywords or is_django_unittest(request): # When the db is created, use the original cachables async_to_sync(element_cache.cache_provider.clear_cache)() element_cache.ensure_cache(reset=True) # Set constant default change_id cast(MemoryCacheProvider, element_cache.cache_provider).default_change_id = 1
def startup(): """ Runs commands that are needed at startup. Sets the cache, constants and startup history """ if os.environ.get("NO_STARTUP"): return from openslides.utils.constants import set_constants, get_constants_from_apps from openslides.utils.cache import element_cache from openslides.core.models import History set_constants(get_constants_from_apps()) element_cache.ensure_cache() History.objects.build_history()