Show More
@@ -20,6 +20,8 b' import errno' | |||
|
20 | 20 | import logging |
|
21 | 21 | |
|
22 | 22 | import msgpack |
|
23 | import redis | |
|
24 | ||
|
23 | 25 | from dogpile.cache.api import CachedValue |
|
24 | 26 | from dogpile.cache.backends import memory as memory_backend |
|
25 | 27 | from dogpile.cache.backends import file as file_backend |
@@ -124,6 +126,9 b' class FileNamespaceBackend(PickleSeriali' | |||
|
124 | 126 | arguments['lock_factory'] = CustomLockFactory |
|
125 | 127 | super(FileNamespaceBackend, self).__init__(arguments) |
|
126 | 128 | |
|
129 | def __repr__(self): | |
|
130 | return '{} `{}`'.format(self.__class__, self.filename) | |
|
131 | ||
|
127 | 132 | def list_keys(self, prefix=''): |
|
128 | 133 | prefix = '{}:{}'.format(self.key_prefix, prefix) |
|
129 | 134 | |
@@ -167,6 +172,23 b' class FileNamespaceBackend(PickleSeriali' | |||
|
167 | 172 | |
|
168 | 173 | |
|
169 | 174 | class BaseRedisBackend(redis_backend.RedisBackend): |
|
175 | ||
|
176 | def _create_client(self): | |
|
177 | args = {} | |
|
178 | ||
|
179 | if self.url is not None: | |
|
180 | args.update(url=self.url) | |
|
181 | ||
|
182 | else: | |
|
183 | args.update( | |
|
184 | host=self.host, password=self.password, | |
|
185 | port=self.port, db=self.db | |
|
186 | ) | |
|
187 | ||
|
188 | connection_pool = redis.ConnectionPool(**args) | |
|
189 | ||
|
190 | return redis.StrictRedis(connection_pool=connection_pool) | |
|
191 | ||
|
170 | 192 | def list_keys(self, prefix=''): |
|
171 | 193 | prefix = '{}:{}*'.format(self.key_prefix, prefix) |
|
172 | 194 | return self.client.keys(prefix) |
General Comments 0
You need to be logged in to leave comments.
Login now