Created
July 18, 2013 18:58
-
-
Save caryfitzhugh/6031998 to your computer and use it in GitHub Desktop.
stream offsetting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_cached_hits(cache_results, start, size) | |
number_to_pull_from_cache = [0, (cache_results.length - start)].max | |
# DO the search | |
if (number_to_pull_from_cache > 0) | |
# Take number_to_pull from the *END* of the cache_results | |
results = cache_results[ ...??] + search_results | |
# Then slice that # off the end of the results | |
results = results[0..(-1 * number_to_pull_from_cache)] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment