* 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
()
| 312 | * deleting the oldest entry |
| 313 | */ |
| 314 | function createCache() { |
| 315 | var keys = []; |
| 316 | |
| 317 | function cache( key, value ) { |
| 318 | // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
| 319 | if ( keys.push( key + " " ) > Expr.cacheLength ) { |
| 320 | // Only keep the most recent entries |
| 321 | delete cache[ keys.shift() ]; |
| 322 | } |
| 323 | return (cache[ key + " " ] = value); |
| 324 | } |
| 325 | return cache; |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * Mark a function for special use by Sizzle |