Total Complexity | 4 |
Total Lines | 20 |
Duplicated Lines | 0 % |
1 | from django_redis.cache import RedisCache as PlainRedisCache |
||
7 | class RedisCache(PlainRedisCache): |
||
8 | |||
9 | @property |
||
10 | def __client(self): |
||
11 | try: |
||
12 | return self.client.get_client() |
||
13 | except Exception as exc: |
||
14 | raise NotImplementedError( |
||
15 | "RedisCache doesn't have a raw client: %r. " |
||
16 | "Use 'redis_cache.client.DefaultClient' as the CLIENT_CLASS !" % exc |
||
17 | ) |
||
18 | |||
19 | def lock(self, key, expire=None, id=None): |
||
20 | return Lock(self.__client, key, expire=expire, id=id) |
||
21 | |||
22 | def reset_all(self): |
||
23 | """ |
||
24 | Forcibly deletes all locks if its remains (like a crash reason). Use this with care. |
||
25 | """ |
||
26 | reset_all(self.__client) |
||
27 |