Home / Function/ deleteLeastRecentlyUsedEntries() — react Function Reference

deleteLeastRecentlyUsedEntries() — react Function Reference

Architecture documentation for the deleteLeastRecentlyUsedEntries() function in LRU.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  79c2e484_7c10_c146_a3c0_8fce5de05fcd["deleteLeastRecentlyUsedEntries()"]
  57da4469_3808_3be7_cda2_0920208b9c2a["LRU.js"]
  79c2e484_7c10_c146_a3c0_8fce5de05fcd -->|defined in| 57da4469_3808_3be7_cda2_0920208b9c2a
  5267fe89_c85e_a332_84a9_676080e35ec5["cleanUp()"]
  5267fe89_c85e_a332_84a9_676080e35ec5 -->|calls| 79c2e484_7c10_c146_a3c0_8fce5de05fcd
  style 79c2e484_7c10_c146_a3c0_8fce5de05fcd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-cache/src/LRU.js lines 56–84

  function deleteLeastRecentlyUsedEntries(targetSize: number) {
    // Delete entries from the cache, starting from the end of the list.
    if (first !== null) {
      const resolvedFirst: Entry<T> = (first: any);
      let last: null | Entry<T> = resolvedFirst.previous;
      while (size > targetSize && last !== null) {
        const onDelete = last.onDelete;
        const previous = last.previous;
        last.onDelete = (null: any);

        // Remove from the list
        last.previous = last.next = (null: any);
        if (last === first) {
          // Reached the head of the list.
          first = last = null;
        } else {
          (first: any).previous = previous;
          previous.next = (first: any);
          last = previous;
        }

        size -= 1;

        // Call the destroy method after removing the entry from the list. If it
        // throws, the rest of cache will not be deleted, but it will be in a
        // valid state.
        onDelete();
      }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does deleteLeastRecentlyUsedEntries() do?
deleteLeastRecentlyUsedEntries() is a function in the react codebase, defined in packages/react-cache/src/LRU.js.
Where is deleteLeastRecentlyUsedEntries() defined?
deleteLeastRecentlyUsedEntries() is defined in packages/react-cache/src/LRU.js at line 56.
What calls deleteLeastRecentlyUsedEntries()?
deleteLeastRecentlyUsedEntries() is called by 1 function(s): cleanUp.

Analyze Your Own Codebase

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

Try Supermodel Free