~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lru_cache.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-08 05:16:30 UTC
  • mfrom: (5728.5.10 log-not-in-branch)
  • Revision ID: pqm@pqm.ubuntu.com-20110408051630-wlk2z0cv73walyz0
(spiv) log no longer raises NoSuchRevision against revisions in the
 repository which are not in the current branch (#241998). Such revisions
 have no revno,
 so display the revision-id instead. It is now possible for a LogRevision to
 have a revno of None. (Matt Giuca) (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""A simple least-recently-used (LRU) cache."""
18
18
 
19
19
from bzrlib import (
20
 
    symbol_versioning,
21
20
    trace,
22
21
    )
23
22
 
61
60
class LRUCache(object):
62
61
    """A class which manages a cache of entries, removing unused ones."""
63
62
 
64
 
    def __init__(self, max_cache=100, after_cleanup_count=None,
65
 
                 after_cleanup_size=symbol_versioning.DEPRECATED_PARAMETER):
66
 
        if symbol_versioning.deprecated_passed(after_cleanup_size):
67
 
            symbol_versioning.warn('LRUCache.__init__(after_cleanup_size) was'
68
 
                                   ' deprecated in 1.11. Use'
69
 
                                   ' after_cleanup_count instead.',
70
 
                                   DeprecationWarning)
71
 
            after_cleanup_count = after_cleanup_size
 
63
    def __init__(self, max_cache=100, after_cleanup_count=None):
72
64
        self._cache = {}
73
65
        # The "HEAD" of the lru linked list
74
66
        self._most_recently_used = None