MCPcopy Create free account
hub / github.com/JsAaron/jQuery / cache

Function cache

2.0.3/Sizzle-annotation.js:334–344  ·  view source on GitHub ↗
(key, value)

Source from the content-addressed store, hash-verified

332 var keys = [];
333
334 function cache(key, value) {
335 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
336 // 为了避免缓存太多,导致内存使用过大,所以这里可以设置cache长度。默认是
337 // cacheLength: 50,
338 if (keys.push(key += " ") > Expr.cacheLength) {
339 // Only keep the most recent entries
340 // 超过缓存,那就把缓存的第一个删掉
341 delete cache[keys.shift()];
342 }
343 return (cache[key] = value);
344 }
345 return cache;
346 }
347

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected