diff --git a/src/caosadvancedtools/cache.py b/src/caosadvancedtools/cache.py index 105f95d4ed56d620bdca00d75ded9e40b88558d6..3a8b7626c184914f22189f335d911f59cc840662 100644 --- a/src/caosadvancedtools/cache.py +++ b/src/caosadvancedtools/cache.py @@ -71,6 +71,13 @@ class AbstractCache(ABC): """ pass + @abstractmethod + def get_default_file_name(self): + """ + Supply a default file name for the cache here. + """ + pass + def __init__(self, db_file=None, force_creation=False): """ db_file: The path of the database file. @@ -79,7 +86,7 @@ class AbstractCache(ABC): regardless of a file at the same path already exists. """ if db_file is None: - self.db_file = "cache.db" + self.db_file = self.get_default_file_name() else: self.db_file = db_file @@ -140,6 +147,9 @@ class Cache(AbstractCache): def get_cache_schema_version(self): return 2 + def get_default_file_name(self): + return "cache.db" + def __init__(self, db_file=None, force_creation=False): super().__init__(db_file, force_creation) @@ -255,7 +265,7 @@ class UpdateCache(AbstractCache): def get_cache_schema_version(self): return 1 - def get_default_file_name(): + def get_default_file_name(self): return "/tmp/crawler_update_cache.db" def __init__(self, db_file=None, force_creation=False):