]> git.parisson.com Git - telemeta.git/commitdiff
Cache: optimize file listing a little bit
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 5 Feb 2014 00:43:57 +0000 (01:43 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 5 Feb 2014 00:43:57 +0000 (01:43 +0100)
telemeta/cache.py

index ea484adde77b055c47a193a665822356451bff3c..8373095f9b49a99b3cd03a1a7c29bf15fc65be4e 100644 (file)
@@ -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)