Skip to content
Snippets Groups Projects
Commit 3b85a515 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Add a delete option to the cache_context

parent 5c81ea7c
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,9 @@ _cache_context_stack = []
class _CacheContext(object):
def __init__(self, tags):
def __init__(self, tags, delete=False):
self.tags = tags
self.delete = delete
def __enter__(self):
_cache_context_stack.append(self.tags)
......@@ -14,9 +15,13 @@ class _CacheContext(object):
def __exit__(self, exc_type, exc_value, traceback):
_cache_context_stack.pop()
if self.delete:
from dune.perftool.generation.cache import delete_cache_items
delete_cache_items(condition=" and ".join(self.tags))
def cache_context(*tags):
return _CacheContext(tags)
def cache_context(*tags, **kwargs):
return _CacheContext(tags, **kwargs)
def get_context_tags():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment