~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/changecache.py

  • Committer: Matt Nordhoff
  • Date: 2009-05-13 14:03:48 UTC
  • mto: (389.2.2 pep8-2009-10)
  • mto: This revision was merged to the branch mainline in revision 392.
  • Revision ID: mnordhoff@mattnordhoff.com-20090513140348-yn43gztulksm62e9
Always use a tuple in string formatting

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