Commits

Andrew Godwin committed 8dbd025

Basic cache skeleton - noop cache and making one per repo server

Comments (0)

Files changed (3)

heechee/webdav/__init__.py

 from heechee.webdav.commit import CommitMixin
 from heechee.webdav.read import ReaderMixin
 from heechee.webdav.storage import FileStorage
-
+from heechee.webdav.caching.noop import NoopCache
 
 class DAVRequest(Request):
     """
         "MKCOL",
     ])
     
-    def __init__(self, repo):
+    def __init__(self, repo, cache=None, storage=None):
         self.repo = repo
-        self.storage = FileStorage()
+        self.cache = cache or NoopCache()
+        self.storage = storage or FileStorage()
     
     def authorization_check(self, username, password, access_type):
         """
Add a comment to this file

heechee/webdav/caching/__init__.py

Empty file added.

heechee/webdav/caching/noop.py

+
+class NoopCache(object):
+    
+    """
+    Simple noop cache - doesn't actually store any keys, and insists nothing
+    actually exists.
+    """
+    
+    def __getitem__(self, key):
+        return KeyError("Key %r not found (noop)" % key)
+    
+    def __setitem__(self, key, value):
+        return
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.