Set `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key.
(self, key, default=None)
| 353 | return default |
| 354 | |
| 355 | def setdefault(self, key, default=None): |
| 356 | """Set `default` if the key is not in the cache otherwise |
| 357 | leave unchanged. Return the value of this key. |
| 358 | """ |
| 359 | self._wlock.acquire() |
| 360 | try: |
| 361 | try: |
| 362 | return self[key] |
| 363 | except KeyError: |
| 364 | self[key] = default |
| 365 | return default |
| 366 | finally: |
| 367 | self._wlock.release() |
| 368 | |
| 369 | def clear(self): |
| 370 | """Clear the cache.""" |
no test coverage detected