Delete empty cache files

When a cache filler function returns without success, we need to delete
the empty file we create so that it doesn't trigger a false positive the
next time we access it.
This commit is contained in:
Bryan Schumaker 2010-10-27 09:09:18 -04:00
parent ba90106588
commit 4f899c4834
1 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@ mkdir = path.mkdir
exists = path.exists
join = path.join
ls = path.ls
rm = path.rm
CACHE_DIR = expand("~/.saria/cache")
mkdir(CACHE_DIR)
@ -26,6 +27,9 @@ class CacheObject:
pass
if success:
return path
else:
rm(path)
else:
return path