def _add_to_cache()

in mozilla_schema_generator/generic_ping.py [0:0]


    def _add_to_cache(url: str, val: str):
        GenericPing.cache_dir.mkdir(parents=True, exist_ok=True)

        cache_file = GenericPing.cache_dir / GenericPing._slugify(url)
        # protect against multiple writers to the cache:
        # https://github.com/mozilla/mozilla-schema-generator/pull/210
        try:
            with open(cache_file, "x") as f:
                f.write(val)
        except FileExistsError:
            pass