/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/lru_cache.py

Support user.signingkey configuration variable in .git/config.

Merged from https://code.launchpad.net/~jelmer/brz/local-git-key/+merge/381000

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""A simple least-recently-used (LRU) cache."""
18
18
 
 
19
from __future__ import absolute_import, division
 
20
 
19
21
from . import (
20
22
    trace,
21
23
    )
 
24
from .sixish import (
 
25
    viewitems,
 
26
    viewkeys,
 
27
    )
22
28
 
23
29
 
24
30
_null_key = object()
130
136
        :return: An unordered list of keys that are currently cached.
131
137
        """
132
138
        # GZ 2016-06-04: Maybe just make this return the view?
133
 
        return list(self._cache.keys())
 
139
        return list(viewkeys(self._cache))
134
140
 
135
141
    def as_dict(self):
136
142
        """Get a new dict with the same key:value pairs as the cache"""
137
 
        return dict((k, n.value) for k, n in self._cache.items())
 
143
        return dict((k, n.value) for k, n in viewitems(self._cache))
138
144
 
139
145
    def cleanup(self):
140
146
        """Clear the cache until it shrinks to the requested size.