'Decorates the given function func to only compute its return
value for input arguments not cached on disk.
Parameters
func: callable, optional
The function to be decorated
ignore: list of strings
A list of arguments name to ignore in the hashing
verbose: integer, optional
The verbosity mode of the function. By default that
of the memory object is used.
mmap_mode: {None, \'r+\', \'r\', \'w+\', \'c\'}, optional
The memmapping mode used when loading from cache
numpy arrays. See numpy.load for the meaning of the
arguments. By default that of the memory object is used.
Returns
decorated_func: MemorizedFunc object
The returned object is a MemorizedFunc object, that is
callable (behaves like a function), but offers extra
methods for cache lookup and management. See the
documentation for :class:`joblib.memory.MemorizedFunc`.'

def cache(self, func=None, ignore=None, verbose=None, mmap_mode=False):

    if (func is None):
        return functools.partial(self.cache, ignore=ignore, verbose=verbose, mmap_mode=mmap_mode)
    if (self.cachedir is None):
        return NotMemorizedFunc(func)
    if (verbose is None):
        verbose = self._verbose
    if (mmap_mode is False):
        mmap_mode = self.mmap_mode
    if isinstance(func, MemorizedFunc):
        func = func.func
    return MemorizedFunc(func, cachedir=self.cachedir, mmap_mode=mmap_mode, ignore=ignore, compress=self.compress, verbose=verbose, timestamp=self.timestamp)
