Markdown caching system

This commit is contained in:
Uriel 2007-06-29 10:28:58 +02:00
parent 99eebb00d5
commit b2145a232f
2 changed files with 22 additions and 3 deletions

17
bin/md_cache Executable file
View file

@ -0,0 +1,17 @@
#!/bin/rc
. 9.rc
cachedir=/tmp/md_cache
mkdir -p $cachedir >[2]/dev/null
tmpfile=$cachedir/mdtmp.$pid
score=`{{tee $tmpfile || exit 1} | sha1sum}
cachefile=$cachedir/$score
if(test -f $cachefile)
cat $cachefile
if not {
markdown.pl < $tmpfile | tee $cachefile.$pid
mv $cachefile.$pid $cachefile
}
rm $tmpfile >[2]/dev/null