MCPcopy Create free account
hub / github.com/idank/explainshell / createCache

Function createCache

explainshell/web/static/js/jquery.js:3851–3863  ·  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

3849 * deleting the oldest entry
3850 */
3851function createCache() {
3852 var cache,
3853 keys = [];
3854
3855 return (cache = function( key, value ) {
3856 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
3857 if ( keys.push( key += " " ) > Expr.cacheLength ) {
3858 // Only keep the most recent entries
3859 delete cache[ keys.shift() ];
3860 }
3861 return (cache[ key ] = value);
3862 });
3863}
3864
3865/**
3866 * Mark a function for special use by Sizzle

Callers 1

jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected