2 lines
9.5 KiB
JavaScript
2 lines
9.5 KiB
JavaScript
|
import{_ as e,c as t,o as a,N as r}from"./chunks/framework.0799945b.js";const p=JSON.parse('{"title":"Class: LRUCache<K, V>","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/classes/lib/lru-cache.LRUCache.md","lastUpdated":null}'),o={name:"api/classes/lib/lru-cache.LRUCache.md"},c=r('<h1 id="class-lrucache-k-v" tabindex="-1">Class: LRUCache<K, V> <a class="header-anchor" href="#class-lrucache-k-v" aria-label="Permalink to "Class: LRUCache<K, V\\>""></a></h1><p><a href="./../../modules/lib/lru-cache">lib/lru-cache</a>.LRUCache</p><p>A LRU cache intended for caching pure functions.</p><h2 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-label="Permalink to "Type parameters""></a></h2><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>K</code></td></tr><tr><td style="text-align:left;"><code>V</code></td></tr></tbody></table><h2 id="constructors" tabindex="-1">Constructors <a class="header-anchor" href="#constructors" aria-label="Permalink to "Constructors""></a></h2><h3 id="constructor" tabindex="-1">constructor <a class="header-anchor" href="#constructor" aria-label="Permalink to "constructor""></a></h3><p>• <strong>new LRUCache</strong><<code>K</code>, <code>V</code>>(<code>maxSize</code>)</p><h4 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-label="Permalink to "Type parameters""></a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>K</code></td></tr><tr><td style="text-align:left;"><code>V</code></td></tr></tbody></table><h4 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to "Parameters""></a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>maxSize</code></td><td style="text-align:left;"><code>number</code></td><td style="text-align:left;">The maximum size for this cache. We recommend setting this to be one less than a power of 2, as most hashtables - including V8's Object hashtable (<a href="https://crsrc.org/c/v8/src/objects/ordered-hash-table.cc" target="_blank" rel="noreferrer">https://crsrc.org/c/v8/src/objects/ordered-hash-table.cc</a>) - uses powers of two for hashtable sizes. It can't exactly be a power of two, as a .set() call could temporarily set the size of the map to be maxSize + 1.</td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/70cda5f/src/lib/lru-cache.ts#L23" target="_blank" rel="noreferrer">profectus/src/lib/lru-cache.ts:23</a></p><h2 id="properties" tabindex="-1">Properties <a class="header-anchor" href="#properties" aria-label="Permalink to "Properties""></a></h2><h3 id="first" tabindex="-1">first <a class="header-anchor" href="#first" aria-label="Permalink to "first""></a></h3><p>• <code>Private</code> <strong>first</strong>: <code>undefined</code> | <code>ListNode</code><<code>K</code>, <code>V</code>> = <code>undefined</code></p><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/70cda5f/src/lib/lru-cache.ts#L11" target="_blank" rel="noreferrer">profectus/src/lib/lru-cache.ts:11</a></p><hr><h3 id="last" tabindex="-1">last <a class="header-anchor" href="#last" aria-label="Permalink to "last""></a></h3><p>• <code>Private</code> <strong>last</strong>: <code>undefined</code> | <code>ListNode</code><<code>K</
|