Home / Function/ clear() — langchain Function Reference

clear() — langchain Function Reference

Architecture documentation for the clear() function in entity.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  33aac564_78c0_a01d_38c8_0a4c9755f4c3["clear()"]
  65c1d19b_b721_7b61_7b71_c0d54a3a49e7["UpstashRedisEntityStore"]
  33aac564_78c0_a01d_38c8_0a4c9755f4c3 -->|defined in| 65c1d19b_b721_7b61_7b71_c0d54a3a49e7
  8571bd81_5e8d_c782_2b9d_90df202eaae0["clear()"]
  33aac564_78c0_a01d_38c8_0a4c9755f4c3 -->|calls| 8571bd81_5e8d_c782_2b9d_90df202eaae0
  style 33aac564_78c0_a01d_38c8_0a4c9755f4c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/memory/entity.py lines 197–208

    def clear(self) -> None:
        def scan_and_delete(cursor: int) -> int:
            cursor, keys_to_delete = self.redis_client.scan(
                cursor,
                f"{self.full_key_prefix}:*",
            )
            self.redis_client.delete(*keys_to_delete)
            return cursor

        cursor = scan_and_delete(0)
        while cursor != 0:
            scan_and_delete(cursor)

Domain

Subdomains

Calls

Frequently Asked Questions

What does clear() do?
clear() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/memory/entity.py.
Where is clear() defined?
clear() is defined in libs/langchain/langchain_classic/memory/entity.py at line 197.
What does clear() call?
clear() calls 1 function(s): clear.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free