MCPcopy
hub / github.com/apache/caldera / createCache

Function createCache

static/jquery/jquery.js:912–924  ·  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

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

Callers 1

jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected