Skip to content
Snippets Groups Projects
Commit 75f9f5b3 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

FIX: make use of the default filename function

parent c53e35d3
No related branches found
No related tags found
2 merge requests!59FIX: if multiple updates for one entity exist, the retrieve would result in an...,!46F cache version
......@@ -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):
......
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