diff --git a/oxrlib/cache.py b/oxrlib/cache.py index d19703201152cf1b364f1a15b350fc441438a7c1..03511d49d7f5de148ae2e9611226160bf291a97c 100644 --- a/oxrlib/cache.py +++ b/oxrlib/cache.py @@ -33,6 +33,10 @@ class CacheBase: def __init__(self, dir_path, **kwargs): self.dir_path = dir_path + try: + self.CacheFile = kwargs.pop('file_class') + except KeyError: + pass self.fn_patterns = {} self.setup(**kwargs) @@ -62,3 +66,14 @@ class CacheBase: @_wrap_api_method def historical(self, date, base): return {'date': date.isoformat(), 'base': base} + + +class WriteCacheFile(CacheFileBase): + ERRORS_MAP = [] + + +class CacheWriter(CacheBase): + CacheFile = WriteCacheFile + + def open(self, path): + return self.CacheFile(path, 'w')