~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/changecache.py

  • Committer: Michael Hudson
  • Date: 2009-06-25 02:45:34 UTC
  • mfrom: (371.1.13 no-transport-sharing)
  • Revision ID: michael.hudson@canonical.com-20090625024534-3kv75gtfge51r656
fix the horrible connection-sharing bug (#390972) and a few other ones about serving .bzr data

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
            pass
100
100
 
101
101
 
 
102
class FileChangeCache(object):
 
103
 
 
104
    def __init__(self, cache_path):
 
105
 
 
106
        if not os.path.exists(cache_path):
 
107
            os.mkdir(cache_path)
 
108
 
 
109
        self._changes_filename = os.path.join(cache_path, 'filechanges.sql')
 
110
 
 
111
    def get_file_changes(self, entry):
 
112
        cache = FakeShelf(self._changes_filename)
 
113
        changes = cache.get(entry.revid)
 
114
        if changes is None:
 
115
            changes = self.history.get_file_changes_uncached(entry)
 
116
            cache.add(entry.revid, changes)
 
117
        return changes
 
118
 
 
119
 
102
120
class RevInfoDiskCache(object):
103
121
    """Like `RevInfoMemoryCache` but backed in a sqlite DB."""
104
122