Commits

ZyX_I committed ea538d8

@%aurum: Fixed getcrf

Comments (0)

Files changed (4)

autoload/aurum.vim

 "▶1 
 scriptencoding utf-8
 execute frawor#Setup('0.1', {'@%aurum/repo': '5.0',
-            \                '@aurum/cache': '1.0',
+            \                '@aurum/cache': '2.0',
             \            '@%aurum/cmdutils': '3.0',})
 "▶1 getcrf
+function s:F.id(val)
+    return a:val
+endfunction
 function s:F.getcrf()
-    let buf=bufnr('%')
-    if !has_key(s:_r.cache.cachebvars, buf)
-        let cbvar={}
-    endif
-    let cbvar=s:_r.cache.cachebvars[buf]
+    let cbvar=s:_r.cache.getcbvar()
     if has_key(cbvar, '__relfname') && has_key(cbvar, 'repo') &&
                 \localtime()-cbvar._timerepo<cbvar._maxtimerepo
         return [cbvar, cbvar.repo, cbvar.__relfname]
         return [cbvar, 0, 0]
     endtry
     if repo isnot 0 && file isnot 0
-        let cbvar.repo=repo
-        let cbvar._timerepo=localtime()
-        let cbvar._maxtimerepo=s:_f.getoption('repocachetime')
+        call s:_r.cache.get('repo', s:F.id, [repo], {})
         let cbvar.__relfname=file
     endif
     return [cbvar, repo, file]
 @aurum/cache:
     0.1: Added _r.cache.del().
     1.0: Added _r.getcrf(), removed cachebvars export
+    2.0: Removed getcrf, added _r.cache.getcbvar
 ftplugin/aurumlog:
     0.1: Added OpenAny and AnnotateAny mappings.
 @%aurum/drivers/common/hypsites:
             \                     '@/fwc': '0.3',
             \            '@/autocommands': '0.0',
             \               '@/resources': '0.0',
-            \              '@aurum/cache': '1.0',})
+            \              '@aurum/cache': '2.0',})
 "▶1 Messages
 let s:_messages={
             \'afail': 'Failed to load aurum:// function from %s',

plugin/aurum/cache.vim

 "▶1
 scriptencoding utf-8
 if !exists('s:_pluginloaded')
-    execute frawor#Setup('1.0', {'@/resources': '0.0',
+    execute frawor#Setup('2.0', {'@/resources': '0.0',
                 \                  '@/options': '0.0',}, 0)
     finish
 elseif s:_pluginloaded
     autocmd BufWipeOut,BufFilePost * :call s:F.bufwipeout()
 augroup END
 let s:_augroups+=['AurumCacheBufVars']
-"▶1 getcachedval :: key, func, args, dict → val + cbvar
-function s:F.getcachedval(key, Func, args, dict)
+"▶1 getcbvar ::  () + buf, cachebvars → cbvar + cachebvars?
+function s:F.getcbvar()
     let buf=bufnr('%')
     if !has_key(s:cachebvars, buf)
         let s:cachebvars[buf]={}
     endif
-    let cbvar=s:cachebvars[buf]
+    return s:cachebvars[buf]
+endfunction
+"▶1 getcachedval :: key, func, args, dict → val + cbvar
+function s:F.getcachedval(key, Func, args, dict)
+    let cbvar=s:F.getcbvar()
     if !(has_key(cbvar, a:key) &&
                 \localtime()-cbvar['_time'.a:key]<cbvar['_maxtime'.a:key])
         let cbvar[a:key]=call(a:Func, a:args, a:dict)
 "▶1 Post cache resource
 call s:_f.postresource('cache', {'get': s:F.getcachedval,
             \                    'del': s:F.delcachedval,
-            \             'cachebvars': s:cachebvars,})
+            \               'getcbvar': s:F.getcbvar,})
 "▶1
 call frawor#Lockvar(s:, '_pluginloaded,cachebvars')
 " vim: ft=vim ts=4 sts=4 et fmr=▶,▲
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.