MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / createCache

Function createCache

public/localscripts/calculationQuestion/jquery.js:1165–1177  ·  view source on GitHub ↗

* Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry

()

Source from the content-addressed store, hash-verified

1163 * deleting the oldest entry
1164 */
1165function createCache() {
1166 var keys = [];
1167
1168 function cache( key, value ) {
1169 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
1170 if ( keys.push( key += " " ) > Expr.cacheLength ) {
1171 // Only keep the most recent entries
1172 delete cache[ keys.shift() ];
1173 }
1174 return (cache[ key ] = value);
1175 }
1176 return cache;
1177}
1178
1179/**
1180 * Mark a function for special use by Sizzle

Callers 1

jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected