1
0
mirror of https://github.com/limosek/zaf.git synced 2025-11-01 18:17:37 +01:00

Repaired and reworked caching

This commit is contained in:
Lukas Macura
2016-12-01 16:57:26 +01:00
parent bc1cbaf144
commit 407fb2f77f
6 changed files with 125 additions and 82 deletions

View File

@@ -19,16 +19,8 @@ else
fi
if ! zaf_fromcache "$key"; then
zaf_fromcache "$key" >/dev/null 2>/dev/null
[ $? -eq 3 ] && { zaf_err "Operation $key already in progress."; }
if zaf_which at >/dev/null 2>/dev/null; then
at -M now >/dev/null 2>/dev/null <<EOF
. $(dirname $0)/preload.sh; tmpf=\$(zaf_tmpfile cache); $@ 2>"\$tmpf" | zaf_tocache_stdin "$key" "$seconds" ; [ -s \$tmpf ] && zaf_wrn <\$tmpf
EOF
else
tmpf=$(zaf_tmpfile cache)
$@ 2>"$tmpf" | zaf_tocache_stdin "$key" "$seconds"
[ -s $tmpf ] && zaf_wrn <$tmpf
fi
tmpf=$(zaf_tmpfile cache)
$@ 2>"$tmpf" | zaf_tocache_stdin "$key" "$seconds"
[ -s $tmpf ] && zaf_wrn <$tmpf
fi