~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lru_cache.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-23 20:04:42 UTC
  • mto: (3735.2.161 brisbane-core)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090323200442-10qwt4ws636wwjwl
Cleanup, in preparation for merging to brisbane-core.

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
    def clear(self):
152
152
        """Clear out all of the cache."""
153
153
        # Clean up in LRU order
154
 
        for key in self._cache.keys():
155
 
            self._remove(key)
156
 
        assert not self._cache
157
 
        assert not self._cleanup
158
 
        self._queue = deque()
159
 
        self._refcount = {}
 
154
        while self._cache:
 
155
            self._remove_lru()
160
156
 
161
157
    def resize(self, max_cache, after_cleanup_count=None):
162
158
        """Change the number of entries that will be cached."""
251
247
        val = LRUCache._remove(self, key)
252
248
        self._value_size -= self._compute_size(val)
253
249
 
254
 
    def clear(self):
255
 
        LRUCache.clear(self)
256
 
        self._value_size = 0
257
 
 
258
250
    def resize(self, max_size, after_cleanup_size=None):
259
251
        """Change the number of bytes that will be cached."""
260
252
        self._update_max_size(max_size, after_cleanup_size=after_cleanup_size)