Manage a cache for file data # $Header: /CVSROOT/filecache/DESCRIPTION,v 1.1 2006/11/13 04:44:18 tino Exp $ # # $Log: DESCRIPTION,v $ # Revision 1.1 2006/11/13 04:44:18 tino # first checkin # Sometimes you want to cache some data onto a filesystem with a name which is not suitable for the filesystem. And you want the cache to grow such that it can contain any amount of information. Filecache exactly allows to do this. Basic use is like follows:
name='*/\/\*../
%=?|%'
file="`filecache out "$name"`"
if [ -f "$file" ]
then
	echo "found"
else
	echo "new"
	readthefile "$name" > "$file"
fi
Note that the result of filecache depends on the contents of out, so the name will change as soon as the cache changes. So never use softlinks to link to a cached file or save the name of the file anywhere. Always be sure to re-evaluate it through filecache.