def clear(self):
self._lock.acquire_write()<EOL>try:<EOL><INDENT>was_closed = self._dict is None<EOL>if was_closed:<EOL><INDENT>self.open()<EOL><DEDENT>if len(self._dict):<EOL><INDENT>self._dict.clear()<EOL>self._dict.sync()<EOL><DEDENT>if was_closed:<EOL><INDENT>self.close()<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>self._lock.release()<EOL><DEDENT>
Delete all entries.