def recache(i):
    """
    Input:  {}

    Output: {
              return       - return code =  0, if successful
                                         >  0, if error
              (error)      - error text if return > 0
            }
    """

    o=i.get('out','')

    # Listing all repos
    r=ck.access({'action':'list',
                 'module_uoa':ck.cfg['repo_name']})
    if r['return']>0: return r
    l=r['lst']

    cru={}
    cri={}

    # Processing repos
    # We need 2 passes (if some repos such as remote ones are referenced inside new repos)

    for ps in [0,1]:
        for q in l:
            if ps==0 or (ps==1 and q.get('processed','')!='yes'):
               ruoa=q['repo_uoa']
               muoa=q['module_uoa']
               duoa=q['data_uoa']
               duid=q['data_uid']

               # First try to load from cache to check that not remote ...
               remote=False
               rx=ck.load_repo_info_from_cache({'repo_uoa':duoa})
               if rx['return']==0: 
                  rd=rx.get('dict',{})
                  if rd.get('remote','')=='yes':
                     remote=True

               if not remote:
                  if duid==ck.cfg['repo_uid_default'] or duid==ck.cfg['repo_uid_local']:
                     if o=='con':
                        ck.out('Skipping repo '+duoa+' ...')
                  else:
                     if o=='con':
                        ck.out('Processing repo '+duoa+' ...')

                     # Repo dictionary (may be changing in .ckr.json)
                     dt={}

                     # Find real repo and get .ckr.json
                     rx=ck.access({'action':'where',
                                   'module_uoa':muoa,
                                   'data_uoa':duoa})
                     if rx['return']==0: 
                        pckr=os.path.join(rx['path'], ck.cfg['repo_file'])
                        if os.path.isfile(pckr):
                           rx=ck.load_json_file({'json_file':pckr})
                           if rx['return']>0: return rx

                           dt=rx['dict']['dict']

                     # Load extra info repo (do not use repo, since may not exist in cache)
                     rx=ck.access({'action':'load',
                                   'module_uoa':muoa,
                                   'data_uoa':duoa})
                     if rx['return']>0: 
                        if ps==0:
                           continue
                        else:
                           return rx

                     if len(dt)==0:
                        dt=rx['dict']
                     else:
                        if rx['dict'].get('path','')!='':
                           dt['path']=rx['dict']['path']

                     dname=rx['data_name']
                     dalias=rx['data_alias']
                     dp=rx['path']

                     if duoa!=duid:
                        cru[duoa]=duid

                     dd={'dict':dt}

                     dd['data_uid']=duid
                     dd['data_uoa']=duoa
                     dd['data_alias']=dalias
                     dd['data_name']=dname
                     dd['path_to_repo_desc']=dp

                     cri[duid]=dd

                  q['processed']='yes'

        # Recording 
        ck.cache_repo_uoa=cru
        ck.cache_repo_info=cri

        rx=ck.save_repo_cache({})
        if rx['return']>0: return rx

        rx=ck.reload_repo_cache({'force':'yes'})
        if rx['return']>0: return rx

    if o=='con':
       ck.out('')
       ck.out('Repositories were successfully recached!')

    return {'return':0}
Input:  {}

    Output: {
              return       - return code =  0, if successful
                                         >  0, if error
              (error)      - error text if return > 0
            }