From: Guillaume Pellerin Date: Wed, 5 Feb 2014 00:43:57 +0000 (+0100) Subject: Cache: optimize file listing a little bit X-Git-Tag: 1.4.6^2~41 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=25b17e140dc2be0447ad8bb9896e725b28681203;p=telemeta.git Cache: optimize file listing a little bit --- diff --git a/telemeta/cache.py b/telemeta/cache.py index ea484add..8373095f 100644 --- a/telemeta/cache.py +++ b/telemeta/cache.py @@ -58,12 +58,13 @@ class TelemetaCache(object): return list def exists(self, file): - self.files = self.get_files() + if not file in self.files: + self.files = self.get_files() return file in self.files def delete_item_data(self, public_id): # public_id is the public_id of an item - for file in self.get_files(): + for file in self.files: if public_id in file: os.remove(self.dir + os.sep + file)