diff options
author | Adam Spiers <adamspiers@users.sourceforge.net> | 2000-08-02 13:45:51 +0000 |
---|---|---|
committer | Adam Spiers <adamspiers@users.sourceforge.net> | 2000-08-02 13:45:51 +0000 |
commit | fd15ea0fb5f43a05647e9755f2c86aabd6ee95f8 (patch) | |
tree | 30430d5582628b202d8932a8d85576b0970edbf7 /Completion/Base/_cache_invalid | |
parent | b2aebcad027eab3339677eb790bfa41b37c3aef0 (diff) | |
download | zsh-fd15ea0fb5f43a05647e9755f2c86aabd6ee95f8.tar.gz zsh-fd15ea0fb5f43a05647e9755f2c86aabd6ee95f8.tar.xz zsh-fd15ea0fb5f43a05647e9755f2c86aabd6ee95f8.zip |
12486: new completion caching layer
Diffstat (limited to 'Completion/Base/_cache_invalid')
-rw-r--r-- | Completion/Base/_cache_invalid | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Completion/Base/_cache_invalid b/Completion/Base/_cache_invalid new file mode 100644 index 000000000..e55381439 --- /dev/null +++ b/Completion/Base/_cache_invalid @@ -0,0 +1,21 @@ +#autoload +# +# Function to decide whether a completions cache needs rebuilding + +local _cache_ident _cache_dir _cache_path _cache_policy +_cache_ident="$1" + +# If the cache is disabled, we never want to rebuild it, so pretend +# it's valid. +zstyle -t ":completion:${curcontext}:" use-cache || return 1 + +zstyle -s ":completion:${curcontext}:" cache-path _cache_dir +: ${_cache_dir:=${ZDOTDIR:-$HOME}/.zcompcache} +_cache_path="$_cache_dir/$_cache_ident" + +# See whether the caching policy says that the cache needs rebuilding +# (the policy will return 0 if it does). +zstyle -s ":completion:${curcontext}:" cache-policy _cache_policy +[[ -n "$_cache_policy" ]] && "$_cache_policy" "$_cache_path" && return 0 + +return 1 |