docs: def cache(self, f):
          """Cache a function using the context's cache directory."""
          if self._memory is None:  # pragma: no cover
              logger.debug("Joblib is not installed: skipping cacheing.")
              return f
          assert f
          # NOTE: discard self in instance methods.
          if 'self' in inspect.getargspec(f).args:
              ignore = ['self']
          else:
              ignore = None
          disk_cached = self._memory.cache(f, ignore=ignore)
          return disk_cached