Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: caching mechanism and Re: PATCH Completion for _yum



2016/12/13 19:10, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:

>>  if ( [[ ${+_dput_cfhosts} -eq 0 ]] || _cache_invalid dputhosts ) && ! _retrieve_cache dputhosts; then
>> - which makes no sense to me.
> 
> I went through correcting other cases of this particular broken logic.
> Substituting instead this logic:
>  if (( ! $+_dput_cfhosts[1] )) && { _cache_invalid dputhosts ||
>      ! _retrieve_cache dputhosts }

I guess what is intended by the original code is to be sure to regenerate
the data if the cache is invalid, even if the variable _dput_cfhosts
already exists in the current zsh.

But,

> Whether we want to be keeping caches also in a global variable is a
> different question

keeping the data in a variable may not be a good idea.
Suppose one zsh (zsh-A), which is still running, has created a cache long
time ago (and the cache is now invalid). If another zsh refreshes the cache,
zsh-A will not refresh its _dput_cfhosts next time it needs it, since the
cache is now valid.




Messages sorted by: Reverse Date, Date, Thread, Author