<commit_before>import os

from whack.caching import DirectoryCacher, NoCachingStrategy
import whack.builder

def install(package, install_dir, caching, builder_uris, params):
    if caching.enabled:
        cacher = DirectoryCacher(os.path.expanduser("~/.cache/whack/builds"))
    else:
        cacher = NoCachingStrategy()
            
    builder = whack.builder.Builders(cacher, builder_uris)
    builder.install(package, install_dir, params)
<commit_msg>Implement HTTP caching when CLI option is set<commit_after>import os

from whack.caching import HttpCacher, DirectoryCacher, NoCachingStrategy
import whack.builder

def install(package, install_dir, caching, builder_uris, params):
    if not caching.enabled:
        cacher = NoCachingStrategy()
    elif caching.http_cache_url is not None:
        # TODO: add DirectoryCacher in front of HttpCacher
        cacher = HttpCacher(caching.http_cache_url, caching.http_cache_key)
    else:
        cacher = DirectoryCacher(os.path.expanduser("~/.cache/whack/builds"))
            
    builder = whack.builder.Builders(cacher, builder_uris)
    builder.install(package, install_dir, params)

{'fraction_non_alphanumeric': 0.08653846153846154, 'fraction_numerical': 0.0, 'mean_word_length': 3.9782608695652173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1028440', 'n_tokens_mistral': 355, 'n_tokens_neox': 342, 'n_words': 80}