MCPcopy
hub / github.com/facebook/react / access

Function access

packages/react-cache/src/LRU.js:116–143  ·  view source on GitHub ↗
(entry: Entry<T>)

Source from the content-addressed store, hash-verified

114 }
115
116 function access(entry: Entry<T>): T {
117 const next = entry.next;
118 if (next !== null) {
119 // Entry already cached
120 const resolvedFirst: Entry<T> = (first: any);
121 if (first !== entry) {
122 // Remove from current position
123 const previous = entry.previous;
124 previous.next = next;
125 next.previous = previous;
126
127 // Append to head
128 const last = resolvedFirst.previous;
129 last.next = entry;
130 entry.previous = last;
131
132 resolvedFirst.previous = entry;
133 entry.next = resolvedFirst;
134
135 first = entry;
136 }
137 } else {
138 // Cannot access a deleted entry
139 // TODO: Error? Warning?
140 }
141 scheduleCleanUp();
142 return entry.value;
143 }
144
145 function setLimit(newLimit: number): void {
146 LIMIT = newLimit;

Callers

nothing calls this directly

Calls 1

scheduleCleanUpFunction · 0.85

Tested by

no test coverage detected