MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / createCache

Function createCache

libs/jquery-3.5.1/jquery-3.5.1.js:903–917  ·  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

901 * deleting the oldest entry
902 */
903function createCache() {
904 var keys = [];
905
906 function cache( key, value ) {
907
908 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
909 if ( keys.push( key + " " ) > Expr.cacheLength ) {
910
911 // Only keep the most recent entries
912 delete cache[ keys.shift() ];
913 }
914 return ( cache[ key + " " ] = value );
915 }
916 return cache;
917}
918
919/**
920 * Mark a function for special use by Sizzle

Callers 1

jquery-3.5.1.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected