<commit_before><?php

namespace CatLab\Assets\Laravel\Helpers;

/**
 * Class Cache
 * @package CatLab\Assets\Laravel\Helpers
 */
class Cache
{
    /**
     * @return Cache
     */
    public static function instance()
    {
        static $in;
        if (!isset($in)) {
            $in = new self();
        }
        return $in;
    }

    public function has($key)
    {
        return file_exists($this->getPath($key));
    }

    public function get($key)
    {
        return file_get_contents($this->getPath($key));
    }

    public function put($key, $content, $lifetime = null)
    {
        file_put_contents($this->getPath($key), $content);
    }

    /**
     * @param $key
     * @return string
     */
    protected function getPath($key)
    {
        return storage_path('image_cache/' . $key);
    }<commit_msg>Don't use subfolders, so escape cache key.<commit_after><?php

namespace CatLab\Assets\Laravel\Helpers;

/**
 * Class Cache
 * @package CatLab\Assets\Laravel\Helpers
 */
class Cache
{
    /**
     * @return Cache
     */
    public static function instance()
    {
        static $in;
        if (!isset($in)) {
            $in = new self();
        }
        return $in;
    }

    public function has($key)
    {
        return file_exists($this->getPath($key));
    }

    public function get($key)
    {
        return file_get_contents($this->getPath($key));
    }

    public function put($key, $content, $lifetime = null)
    {
        file_put_contents($this->getPath($key), $content);
    }

    /**
     * @param $key
     * @return string
     */
    protected function getPath($key)
    {
        return storage_path('image_cache/' . str_replace('/', '_', $key));
    }
{'fraction_non_alphanumeric': 0.14853801169590644, 'fraction_numerical': 0.0, 'mean_word_length': 2.0718132854578095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '900546', 'n_tokens_mistral': 547, 'n_tokens_neox': 534, 'n_words': 111}