def cached_func(fname=None, cache_dir='default', appname='utool', key_argx=None,
                key_kwds=None, use_cache=None, verbose=None):
    r
    if verbose is None:
        verbose = VERBOSE_CACHE
    def cached_closure(func):
        from utool import util_decor
        import utool as ut
        fname_ = util_inspect.get_funcname(func) if fname is None else fname
        kwdefaults = util_inspect.get_kwdefaults(func)
        argnames   = util_inspect.get_argnames(func)
        if ut.is_method(func):
            argnames = argnames[1:]
        cacher = Cacher(fname_, cache_dir=cache_dir, appname=appname,
                        verbose=verbose)
        if use_cache is None:
            use_cache_ = not util_arg.get_argflag('--nocache-' + fname_)
        else:
            use_cache_ = use_cache
        def cached_wraper(*args, **kwargs):
            try:
                if verbose > 2:
                    print('[util_cache] computing cached function fname_=%s' %
                          ( fname_,))
                cfgstr = get_cfgstr_from_args(func, args, kwargs, key_argx,
                                              key_kwds, kwdefaults, argnames)
                if util_cplat.WIN32:
                    cfgstr = '_' + util_hash.hashstr27(cfgstr)
                assert cfgstr is not None, 'cfgstr=%r cannot be None' % (cfgstr,)
                use_cache__ = kwargs.pop('use_cache', use_cache_)
                if use_cache__:
                    data = cacher.tryload(cfgstr)
                    if data is not None:
                        return data
                data = func(*args, **kwargs)
                cacher.save(data, cfgstr)
                return data
            except Exception as ex:
                from utool import util_dbg
                _dbgdict2 = dict(key_argx=key_argx, lenargs=len(args),
                                 lenkw=len(kwargs),)
                msg = '\n'.join([
                    '+--- UTOOL --- ERROR IN CACHED FUNCTION',
                    'dbgdict2 = ' + util_str.repr4(_dbgdict2),
                ])
                util_dbg.printex(ex, msg)
                raise
        cached_wraper = util_decor.preserve_sig(cached_wraper, func)
        cached_wraper.cacher = cacher
        return cached_wraper
    return cached_closure