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

Function createCache

2.1.1/test/jquery-2.1.1.js:851–863  ·  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

849 * deleting the oldest entry
850 */
851function createCache() {
852 var keys = [];
853
854 function cache( key, value ) {
855 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
856 if ( keys.push( key + " " ) > Expr.cacheLength ) {
857 // Only keep the most recent entries
858 delete cache[ keys.shift() ];
859 }
860 return (cache[ key + " " ] = value);
861 }
862 return cache;
863}
864
865/**
866 * Mark a function for special use by Sizzle

Callers 1

jquery-2.1.1.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected