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

Function createCache

2.1.1/test/jquery-1.11.1.js:888–900  ·  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

886 * deleting the oldest entry
887 */
888function createCache() {
889 var keys = [];
890
891 function cache( key, value ) {
892 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
893 if ( keys.push( key + " " ) > Expr.cacheLength ) {
894 // Only keep the most recent entries
895 delete cache[ keys.shift() ];
896 }
897 return (cache[ key + " " ] = value);
898 }
899 return cache;
900}
901
902/**
903 * Mark a function for special use by Sizzle

Callers 1

jquery-1.11.1.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected