Replace an item that is already present, not disposing it in the process.
(self, key: K, value: V)
| 46 | return len(self._cache) |
| 47 | |
| 48 | def replace(self, key: K, value: V) -> None: |
| 49 | """Replace an item that is already present, not disposing it in the process.""" |
| 50 | # this method complements __setitem__ which should be used for the normal use case. |
| 51 | assert key in self._cache, "Unexpected attempt to update a non-existing item." |
| 52 | self._cache[key] = value |
| 53 | |
| 54 | def clear(self) -> None: |
| 55 | for value in self._cache.values(): |
no outgoing calls