Skip to content

Latest commit

 

History

History
133 lines (92 loc) · 5.91 KB

CHANGELOG.md

File metadata and controls

133 lines (92 loc) · 5.91 KB

@httpx/lru

0.6.0

Minor Changes

Patch Changes

0.5.0

Minor Changes

Patch Changes

0.4.1

Patch Changes

  • #1872 6b5c38e Thanks @belgattitude! - Updated browserslist baseline for 2025

    For most users there won't be any change. Still around 95% on browserslist.

    defaults
    chrome >= 96
    firefox >= 105
    edge >= 113
    safari >= 15
    ios >= 15
    opera >= 103
    not dead
    

0.4.0

Minor Changes

  • #1866 59e5b25 Thanks @belgattitude! - Add getOrInsert method

    const lru = new LRUCache({ maxSize: 2 });
    lru.set("key1", "value1");
    lru.getOrInsert("key1", "value2"); // 👈 will not overwrite the value
    console.log(lru.get("key1")); // value1
  • #1866 fa3287a Thanks @belgattitude! - Rename TinyLRU into LRUCache

  • #1866 59e5b25 Thanks @belgattitude! - Add iterator symbol

    const lru = new LRUCache({ maxSize: 2 });
    lru.set("key1", "value1");
    lru.set("key2", "value2");
    lru.set("key3", "value3");
    // trigger a get to move key2 to the head
    lru.get("key2");
    const results = [];
    // iterate over the cache entries
    for (const [key, value] of lru) {
      results.push([key, value]);
    }
    expect(results).toStrictEqual([
      ["key3", "value3"], // Least recently used
      ["key2", "value2"], // Most recently used
    ]);
  • #1866 59e5b25 Thanks @belgattitude! - Add onEviction callback

    const fn = vi.fn();
    
    const lru = new LRUCacheLRU({
      maxSize: 2,
      onEviction: (key, value) => {
        fn(key, value);
      },
    });
    lru.set("key1", "value1");
    lru.set("key2", "value2");
    lru.set("key3", "value3"); // 👈 Will evict key1 due to capacity
    expect(fn).toHaveBeenCalledExactlyOnceWith("key1", "value1");

0.3.0

Minor Changes

  • 76556f0 - Rename LRUCache in LRUCache

0.2.1

Patch Changes

  • #1859 101e19e Thanks @belgattitude! - Update browserslist minimums

    defaults
    chrome >= 96
    firefox >= 94
    edge >= 91
    safari >= 14
    ios >= 14
    opera >= 83
    

0.2.0

Minor Changes