Permalink
Browse files

docs

  • Loading branch information...
tomtom committed Nov 11, 2012
1 parent 9532e46 commit 3ac0fde75b79aad302abaa2f367f8a48deddbd41
Showing with 21 additions and 7 deletions.
  1. +4 −2 autoload/tlib/cache.vim
  2. +17 −5 doc/tlib.txt
View
@@ -4,7 +4,7 @@
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-06-30.
" @Last Change: 2012-05-11.
-" @Revision: 0.1.209
+" @Revision: 0.1.210
" |tlib#cache#Purge()|: Remove cache files older than N days.
@@ -103,7 +103,9 @@ function! tlib#cache#Get(cfile) "{{{3
endf
-function! tlib#cache#Value(cfile, generator, ftime, ...)
+" Get a cached value from cfile. If it is outdated (compared to ftime)
+" or does not exist, create it calling a generator function.
+function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3
if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime)
let args = a:0 >= 1 ? a:1 : []
let val = call(a:generator, args)
View
@@ -68,6 +68,7 @@ Contents~
tlib#persistent#Dir ..................... |tlib#persistent#Dir()|
tlib#persistent#Filename ................ |tlib#persistent#Filename()|
tlib#persistent#Get ..................... |tlib#persistent#Get()|
+ tlib#persistent#Value ................... |tlib#persistent#Value()|
tlib#persistent#Save .................... |tlib#persistent#Save()|
g:tlib#vim#simalt_maximize .............. |g:tlib#vim#simalt_maximize|
g:tlib#vim#simalt_restore ............... |g:tlib#vim#simalt_restore|
@@ -118,12 +119,13 @@ Contents~
g:tlib#cache#purge_every_days ........... |g:tlib#cache#purge_every_days|
g:tlib#cache#script_encoding ............ |g:tlib#cache#script_encoding|
g:tlib#cache#run_script ................. |g:tlib#cache#run_script|
- g:tlib#cache#silent ..................... |g:tlib#cache#silent|
+ g:tlib#cache#verbosity .................. |g:tlib#cache#verbosity|
g:tlib#cache#dont_purge ................. |g:tlib#cache#dont_purge|
tlib#cache#Dir .......................... |tlib#cache#Dir()|
tlib#cache#Filename ..................... |tlib#cache#Filename()|
tlib#cache#Save ......................... |tlib#cache#Save()|
tlib#cache#Get .......................... |tlib#cache#Get()|
+ tlib#cache#Value ........................ |tlib#cache#Value()|
tlib#cache#MaybePurge ................... |tlib#cache#MaybePurge()|
tlib#cache#Purge ........................ |tlib#cache#Purge()|
tlib#cache#ListFilesInCache ............. |tlib#cache#ListFilesInCache()|
@@ -581,6 +583,9 @@ tlib#persistent#Filename(type, ?file=%, ?mkdir=0)
*tlib#persistent#Get()*
tlib#persistent#Get(cfile)
+ *tlib#persistent#Value()*
+tlib#persistent#Value(...)
+
*tlib#persistent#Save()*
tlib#persistent#Save(cfile, dictionary)
@@ -905,10 +910,12 @@ g:tlib#cache#run_script (default: 1)
1 ... Query user
2 ... Yes
- *g:tlib#cache#silent*
-g:tlib#cache#silent (default: 0)
- If non-nil, don't display a message that files were deleted from the
- cache.
+ *g:tlib#cache#verbosity*
+g:tlib#cache#verbosity (default: 1)
+ Verbosity level:
+ 0 ... Be quiet
+ 1 ... Display informative message
+ 2 ... Display detailed messages
*g:tlib#cache#dont_purge*
g:tlib#cache#dont_purge (default: ['[\/]\.last_purge$'])
@@ -929,6 +936,11 @@ tlib#cache#Save(cfile, dictionary)
*tlib#cache#Get()*
tlib#cache#Get(cfile)
+ *tlib#cache#Value()*
+tlib#cache#Value(cfile, generator, ftime, ...)
+ Get a cached value from cfile. If it is outdated (compared to ftime)
+ or does not exist, create it calling a generator function.
+
*tlib#cache#MaybePurge()*
tlib#cache#MaybePurge()
Call |tlib#cache#Purge()| if the last purge was done before

0 comments on commit 3ac0fde

Please sign in to comment.