Simplified FileBasedCache.clear().
glob.glob1() ignores missing paths.
This commit is contained in:
parent
25829197bb
commit
e42b788960
|
@ -129,8 +129,6 @@ class FileBasedCache(BaseCache):
|
||||||
"""
|
"""
|
||||||
Remove all the cache files.
|
Remove all the cache files.
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(self._dir):
|
|
||||||
return
|
|
||||||
for fname in self._list_cache_files():
|
for fname in self._list_cache_files():
|
||||||
self._delete(fname)
|
self._delete(fname)
|
||||||
|
|
||||||
|
@ -153,8 +151,7 @@ class FileBasedCache(BaseCache):
|
||||||
Get a list of paths to all the cache files. These are all the files
|
Get a list of paths to all the cache files. These are all the files
|
||||||
in the root cache dir that end on the cache_suffix.
|
in the root cache dir that end on the cache_suffix.
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(self._dir):
|
return [
|
||||||
return []
|
os.path.join(self._dir, fname)
|
||||||
filelist = [os.path.join(self._dir, fname) for fname
|
for fname in glob.glob1(self._dir, '*%s' % self.cache_suffix)
|
||||||
in glob.glob1(self._dir, '*%s' % self.cache_suffix)]
|
]
|
||||||
return filelist
|
|
||||||
|
|
Loading…
Reference in New Issue