MCPcopy
hub / github.com/geekape/geek-navigation / createCache

Function createCache

js/jquery.js:893–905  ·  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

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

Callers 1

jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected