(self, key: Hashable, value: Any, ttl: int)
| 129 | self._lock.release() |
| 130 | |
| 131 | def put(self, key: Hashable, value: Any, ttl: int) -> bool: |
| 132 | if not self._lock.acquire(blocking=True, timeout=LOCK_TIMEOUT): |
| 133 | raise Exception("DataCache.put" + ERR_LOCK_FAILED) |
| 134 | try: |
| 135 | self._base[key] = (self._get_ttl_time(ttl), value) |
| 136 | except Exception: |
| 137 | log.error(traceback.format_exc()) |
| 138 | return False |
| 139 | else: |
| 140 | return True |
| 141 | finally: |
| 142 | self._lock.release() |
| 143 | |
| 144 | def tryGet(self, key: Hashable) -> Any: |
| 145 | if not self._lock.acquire(blocking=True, timeout=LOCK_TIMEOUT): |
no test coverage detected