]> kaliko git repositories - mpd-sima.git/blobdiff - sima/lib/cache.py
Improved ETag support, add some stats
[mpd-sima.git] / sima / lib / cache.py
index ebed3fcb3977bf12741163ff35c4a50f25e27f11..d7175617c171849dfcef0a4a47a93a8072707f09 100644 (file)
@@ -23,7 +23,6 @@ dictionary, which in turns means it is not threadsafe for writing.
 """
 
 import os
-import base64
 import codecs
 
 from hashlib import md5
@@ -93,3 +92,9 @@ class FileCache:
     def delete(self, key):
         if not self.forever:
             os.remove(self._fn(key))
+
+    def __iter__(self):
+        for dirpath, dirnames, filenames in os.walk(self.directory):
+            for item in filenames:
+                name = os.path.join(dirpath, item)
+                yield load(codecs.open(name, 'rb'))