MCPcopy
hub / github.com/redis/redis-py / reset

Method reset

redis/client.py:1722–1744  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1720 return True
1721
1722 def reset(self) -> None:
1723 self.command_stack = []
1724 self.scripts = set()
1725 # make sure to reset the connection state in the event that we were
1726 # watching something
1727 if self.watching and self.connection:
1728 try:
1729 # call this manually since our unwatch or
1730 # immediate_execute_command methods can call reset()
1731 self.connection.send_command("UNWATCH")
1732 self.connection.read_response()
1733 except ConnectionError:
1734 # disconnect will also remove any previous WATCHes
1735 self.connection.disconnect()
1736 # clean up the other instance attributes
1737 self.watching = False
1738 self.explicit_transaction = False
1739
1740 # we can safely return the connection to the pool here since we're
1741 # sure we're no longer WATCHing anything
1742 if self.connection:
1743 self.connection_pool.release(self.connection)
1744 self.connection = None
1745
1746 def close(self) -> None:
1747 """Close the pipeline"""

Callers 5

__exit__Method · 0.95
__del__Method · 0.95
closeMethod · 0.95
executeMethod · 0.95

Calls 4

send_commandMethod · 0.45
read_responseMethod · 0.45
disconnectMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected