* 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
()
| 3849 | * deleting the oldest entry |
| 3850 | */ |
| 3851 | function 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 |