class_docstr: Base class for the downloaders
class_docstr_tok: ["Base","class","for","the","downloaders"]
code: def cache(self):
      if self._cache is None:
          # TODO: move this all logic outside into a dedicated caching beast
          lgr.info("Initializing cache for fetches")
          import dbm
  
          # Initiate cache.
          # Very rudimentary caching for now, might fail many ways
          cache_dir = cfg.obtain("datalad.locations.cache")
          if not exists(cache_dir):
              os.makedirs(cache_dir)
          cache_path = opj(cache_dir, "crawl_cache.dbm")
          self._cache = dbm.open(cache_path, "c")
          import atexit
  
          atexit.register(self._cache.close)
      return self._cache
  
imports: import msgpack
  import os
  import sys
  import time
  from abc import ABCMeta, abstractmethod
  import os.path
  from os.path import exists, join, isdir
  from ..None import cfg
  from ..ui import ui
  from ..utils import auto_repr, ensure_unicode, unlink
  from .credentials import CompositeCredential
  from datalad.downloaders import CREDENTIAL_TYPES
  from ..support.exceptions import AccessDeniedError, AccessPermissionExpiredError, AnonymousAccessDeniedError, CapturedException, DownloadError, IncompleteDownloadError, UnaccountedDownloadError
  from ..support.locking import InterProcessLock, try_lock, try_lock_informatively
  from logging import getLogger
label_desc: Use image node_id 11 for calling the BaseDownloader obj's underlying member method code with example usage: obj.cache() and returns: self