Show More
@@ -41,7 +41,7 b' from dogpile.cache.api import Serializer' | |||||
41 | from pyramid.settings import asbool |
|
41 | from pyramid.settings import asbool | |
42 |
|
42 | |||
43 | from rhodecode.lib.memory_lru_dict import LRUDict, LRUDictDebug |
|
43 | from rhodecode.lib.memory_lru_dict import LRUDict, LRUDictDebug | |
44 | from rhodecode.lib.str_utils import safe_str |
|
44 | from rhodecode.lib.str_utils import safe_str, safe_bytes | |
45 |
|
45 | |||
46 |
|
46 | |||
47 | _default_max_size = 1024 |
|
47 | _default_max_size = 1024 | |
@@ -146,20 +146,20 b' class FileNamespaceBackend(PickleSeriali' | |||||
146 | def __repr__(self): |
|
146 | def __repr__(self): | |
147 | return '{} `{}`'.format(self.__class__, self.filename) |
|
147 | return '{} `{}`'.format(self.__class__, self.filename) | |
148 |
|
148 | |||
149 | def list_keys(self, prefix=''): |
|
149 | def list_keys(self, prefix: bytes = b''): | |
150 |
prefix = ' |
|
150 | prefix = b'%b:%b' % (safe_bytes(self.key_prefix), safe_bytes(prefix)) | |
151 |
|
151 | |||
152 |
def cond( |
|
152 | def cond(dbm_key: bytes): | |
153 | if not prefix: |
|
153 | if not prefix: | |
154 | return True |
|
154 | return True | |
155 |
|
155 | |||
156 |
if |
|
156 | if dbm_key.startswith(prefix): | |
157 | return True |
|
157 | return True | |
158 | return False |
|
158 | return False | |
159 |
|
159 | |||
160 | with self._dbm_file(True) as dbm: |
|
160 | with self._dbm_file(True) as dbm: | |
161 | try: |
|
161 | try: | |
162 |
return list(filter(cond, |
|
162 | return list(filter(cond, dbm.keys())) | |
163 | except Exception: |
|
163 | except Exception: | |
164 | log.error('Failed to fetch DBM keys from DB: %s', self.get_store()) |
|
164 | log.error('Failed to fetch DBM keys from DB: %s', self.get_store()) | |
165 | raise |
|
165 | raise |
General Comments 0
You need to be logged in to leave comments.
Login now