| 37 | |
| 38 | |
| 39 | class CacheHandler(BaseConnectionHandler): |
| 40 | settings_name = "CACHES" |
| 41 | exception_class = InvalidCacheBackendError |
| 42 | |
| 43 | def create_connection(self, alias): |
| 44 | params = self.settings[alias].copy() |
| 45 | backend = params.pop("BACKEND") |
| 46 | location = params.pop("LOCATION", "") |
| 47 | try: |
| 48 | backend_cls = import_string(backend) |
| 49 | except ImportError as e: |
| 50 | raise InvalidCacheBackendError( |
| 51 | "Could not find backend '%s': %s" % (backend, e) |
| 52 | ) from e |
| 53 | return backend_cls(location, params) |
| 54 | |
| 55 | |
| 56 | caches = CacheHandler() |
no outgoing calls